|
发表于 2004-2-21 10:35:43
|
显示全部楼层
我装的是RH AS3.0,现在用GCC编译也遇到这样的问题,还不会解决
我已经试过这里所说的所以问题就是#include <iostream> or #include <iostream.h> or using namespace std;都不行
我在console下就是这样打的gcc first.cpp下面是我写的代码
#include <iostream>
//#include <stdlib>
using namespace std;
int main(void)
{
cout<<"hello world"<<endl;
return 1;
}
下面是出错的信息
gcc first.cpp
/tmp/ccV8BSfa.o(.text+0x14): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccV8BSfa.o(.text+0x21): In function `main':
: undefined reference to `std::cout'
/tmp/ccV8BSfa.o(.text+0x26): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccV8BSfa.o(.text+0x2f): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >:perator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
/tmp/ccV8BSfa.o(.text+0x5c): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccV8BSfa.o(.text+0x8b): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccV8BSfa.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status |
|