|
我在程序中加了如下代码:(添加前编译无错误)
string recvstr;
int recvlen = 0;
do
{
memset(buf,0,sizeof(buf));
recvlen = recv(clifd, buf, sizeof(buf), 0);
if( recvlen == -1 )
{
//cout<<"Receive data fail\n";
goto finish;
}
if( recvlen == 0 )
{
//cout<<"peer host close this socket\n";
goto finish;
}
if( strlen(buf) == 0 )
{
//cout<<"Receive none\n";
goto finish;
}
recvstr += buf;
}
while( is_end(buf) != 0 );
添加后报错:
/tmp/ccFkrRoG.o(.text+0x291): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge]()'
/tmp/ccFkrRoG.o(.text+0x30d): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >: perator+=(char const*)'
/tmp/ccFkrRoG.o(.text+0x32d): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
/tmp/ccFkrRoG.o(.text+0x34d): In function `main':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string [in-charge]()'
/tmp/ccFkrRoG.o(.text+0x390): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccFkrRoG.o(.text+0x3bf): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccFkrRoG.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
请高手指教 |
|