关于GCC的问题
对于一个简单的程序比如:
#include<iostream>
int main(int argc,char* argv[]){
std::cout<<8;
return 0;
}
我用GCC可以编译但连接的时候出现以下错误:
: undefined reference to `std::cout'
why.o(.text+0x1b): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(int)'
why.o(.text+0x48): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
why.o(.text+0x77): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
why.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
但是用g++就没有问题了
怎么回事?怎么解决?
谢谢!