linux下更新boost庫後遇到的一則錯誤

 

原先安裝過boost1.43版本的庫,在用"bjam  install" 安裝boost 1.44的版本後,出現以下錯誤:linux

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

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

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

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

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

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

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

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

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

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" 

相關文章
相關標籤/搜索