用gcc怎样编译STL的c++程序?
vcvcc 2004-11-22 11:39:24 如下一个简单的程序
//////////////////////////////////////////////////////////////////////////////
//test.cpp
#include <iostream>
#include <vector>
using namestd
void main()
{
int i;
vector<int> vt;
vector<int>::iterator it;
for(i=0; i<5; i++)
vt.push_back(i);
for(it=vt.begin(); it !=vt.end(); it++)
count << *it <<endl;
}
用gcc编译不连接没有错误
gcc -c test.cpp //ok!
然后连接
gcc -o test.exe test.o //这里出错!
ps,用g++编译没有问题。
问题:如果要用gcc指令编译应怎样做?