请在ibm aix下写过STL程序的人帮忙!!小弟碰到麻烦了!
刚刚写了第一个程序hello world,编译就出了很多问题,后来用了cc_r进行编译,总算通过.
现在写了一个stl向量的小程序,但是报错,我想问问,出了什么问题!请大家帮忙!
程序如下:
#include "stdio.h"
#include <vector>
using namespace std;
void main(void)
{
int a[10]={1,3,9,13,15,3,21,18,3,38};
vector<int> vec(a,a+10);
vector<int>::iterator iter=vec.begin();
for(;iter!=vec.end();iter++)
printf("%d ",*iter);
printf("\n");
printf("hello world\n");
}
编译及错误提示如下:
$cc_r -o hello hello.c
"hello.c", line 2.10: 1506-296 (S) #include file <vector> not found.
"hello.c", line 3.1: 1506-166 (S) Definition of function using requires parentheses.
"hello.c", line 3.7: 1506-276 (S) Syntax error: possible missing '{'?
"hello.c", line 7.16: 1506-046 (S) Syntax error.
"hello.c", line 7.9: 1506-045 (S) Undeclared identifier vector.
"hello.c", line 8.16: 1506-046 (S) Syntax error.
"hello.c", line 8.22: 1506-045 (S) Undeclared identifier iterator.
"hello.c", line 9.20: 1506-021 (S) Expecting struct or union.
"hello.c", line 9.14: 1506-045 (S) Undeclared identifier iter.
|