linux下更新boost库后遇到的一则错误

 

原先安装过boost1.43版本的库,在用"bjam  install" 安装boost 1.44的版本后,出现如下错误:

[root@localhost gridcast]# g++ -I/usr/local/include datetime_tcp_async_server.cpp -lpthread -lboost_system

datetime_tcp_async_server.cpp:142:2: 警告:文件未以空白行结束

/tmp/ccEZqyyV.o: In function `__static_initialization_and_destruction_0(int, int)':

datetime_tcp_async_server.cpp:(.text+0x16c): undefined reference to `boost::system::get_system_category()'

datetime_tcp_async_server.cpp:(.text+0x176): undefined reference to `boost::system::get_generic_category()'

datetime_tcp_async_server.cpp:(.text+0x180): undefined reference to `boost::system::get_generic_category()'

datetime_tcp_async_server.cpp:(.text+0x18a): undefined reference to `boost::system::get_generic_category()'

datetime_tcp_async_server.cpp:(.text+0x194): undefined reference to `boost::system::get_system_category()'

/tmp/ccEZqyyV.o: In function `boost::asio::error::get_system_category()':

datetime_tcp_async_server.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x7): undefined reference to `boost::system::get_system_category()'

/tmp/ccEZqyyV.o: In function `boost::system::error_code::error_code()':

datetime_tcp_async_server.cpp:(.text._ZN5boost6system10error_codeC1Ev[boost::system::error_code::error_code()]+0x10): undefined reference to `boost::system::get_system_category()'

collect2: ld 返回 1

 

/usr/local/inclue/boost/system

[root@localhost system]# find ./ -type f -print|xargs grep "get_system_category" -n
./windows_error.hpp:110:        { return error_code( e, get_system_category() ); }
./cygwin_error.hpp:49:        { return error_code( e, get_system_category() ); }
./error_code.hpp:205:    BOOST_SYSTEM_DECL const error_category &  get_system_category();
./error_code.hpp:208:    static const error_category &  system_category = get_system_category();
./error_code.hpp:216:    static const error_category &  native_ecat    = get_system_category();
./error_code.hpp:315:      error_code() : m_val(0), m_cat(&get_system_category()) {}
./error_code.hpp:343:        m_cat = &get_system_category();
./linux_error.hpp:102:        { return error_code( e, get_system_category() ); }


全新安装版本:

[root@LOG system]#  find ./ -type f -print|xargs grep "get_system_category" -n
./error_code.hpp:211:    inline const error_category &  get_system_category() { return system_category(); }

 

原因:

/usr/local/inclue/boost/system/error_code.hpp not been overwrited,its still the older version.

属于库版本和头文件版本不一致造成的错误。

解决方案:先删除掉以前安装的 /usr/local/include/boost目录,再运行"bjam  install" 

你可能感兴趣的:(更新,boost)