|
源程序:
#include <iostream>
using namespace std;
int main()
{
cout<<"world hello"<<endl;
return 0;
}
g++ -o testcpp testcpp.cpp 可以通过,有结果.
gcc -o testcpp testcpp.cpp 出错了
/tmp/ccuEDHXQ.o: In function `main':
/tmp/ccuEDHXQ.o(.text+0x14): 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/ccuEDHXQ.o(.text+0x21): undefined reference to `std::cout'
/tmp/ccuEDHXQ.o(.text+0x26): 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/ccuEDHXQ.o(.text+0x2f): 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/ccuEDHXQ.o: In function `__static_initialization_and_destruction_0(int, int)':
/tmp/ccuEDHXQ.o(.text+0x5c): undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccuEDHXQ.o: In function `__tcf_0':
/tmp/ccuEDHXQ.o(.text+0x8b): undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccuEDHXQ.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status |
|