我已經安裝了所有Boost庫,但在編譯g++ sda.cpp -lboost_system -lboost_date_time -lboost_regex -lboost_thread -lboost_serialization
編譯程序與Boost.Asio的庫
#include <boost/asio.hpp>
int main()
{
return 0;
}
我得到幾個錯誤時,和編譯失敗。 我使用最新的Ubuntu 10.10。 編譯器說:
/tmp/cc6bld0N.o: In function `__static_initialization_and_destruction_0(int, int)': sda.cpp:(.text+0x52): undefined reference to `boost::system::generic_category()' sda.cpp:(.text+0x5e): undefined reference to `boost::system::generic_category()' sda.cpp:(.text+0x6a): undefined reference to `boost::system::system_category()' /tmp/cc6bld0N.o: In function `boost::asio::error::get_system_category()': sda.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()' collect2: ld returned 1 exit status
什麼問題?
當你說「我已經安裝了所有boost庫」,你的意思是你安裝了它的編譯版本,還是從源代碼構建並安裝了它們? – yasouser 2011-04-20 14:24:19