LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 668|回复: 2

在线等:请教编译时出问题

[复制链接]
发表于 2007-5-22 10:52:59 | 显示全部楼层 |阅读模式
我在程序中加了如下代码:(添加前编译无错误)
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
请高手指教
 楼主| 发表于 2007-5-22 10:56:41 | 显示全部楼层
怎么代码格式都乱了

把tab换成空格都不行
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-22 13:58:17 | 显示全部楼层
已解决
好象是编译器版本问题
谢谢关注
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表