我已經下載了boost並構建它,而不是第一次,但隨後事情開始顯得很奇怪。boost lib命名不見了
起初,我在編譯我的項目(使用升壓)得到這些錯誤:
/usr/local/include/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/thread/exceptions.hpp:51: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/thread/exceptions.hpp:84: undefined reference to `boost::system::system_category()'
/usr/local/include/boost/thread/pthread/thread_data.hpp:152: undefined reference to `vtable for boost::detail::thread_data_base'
/usr/local/include/boost/thread/pthread/thread_data.hpp:195: undefined reference to `boost::detail::get_current_thread_data()'
/usr/local/include/boost/thread/detail/thread.hpp:179: undefined reference to `boost::thread::start_thread_noexcept()'
/usr/local/include/boost/thread/detail/thread.hpp:741: undefined reference to `boost::thread::native_handle()'
/usr/local/include/boost/thread/detail/thread.hpp:767: undefined reference to `boost::thread::join_noexcept()'
/usr/local/include/boost/thread/detail/thread.hpp:779: undefined reference to `boost::thread::do_try_join_until_noexcept(timespec const&, bool&)'
/usr/local/include/boost/thread/pthread/condition_variable.hpp:84: undefined reference to `boost::this_thread::interruption_point()'
/usr/local/include/boost/thread/detail/thread.hpp:90: undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/usr/local/include/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
所以我去檢查,如果一切就緒,並發現該升壓LIB文件,我有沒有有通常的圖書館命名,這是他們只是看起來像:libboost_thread.a
,libboost_system.a
,libboost_date_time.a
,而不是-mt
,-d
等。
我不記得我究竟是如何建造它,但如果我嘗試運行:
boost_src_dir > ./b2 threading=multi link=static variant=debug,release
我得到:
error: Name clash for '<pstage/lib>libboost_atomic.a'
error:
error: Tried to build the target twice, with property sets having
error: these incompatible properties:
error:
error: - <debug-symbols>on <inlining>off <optimization>off <runtime-debugging>on <variant>debug
error: - <debug-symbols>off <define>NDEBUG <inlining>full <optimization>speed <runtime-debugging>off <variant>release
error:
error: Please make sure to have consistent requirements for these
error: properties everywhere in your project, especially for install
error: targets.
不太清楚是怎麼回事,以前的時候,我已經做到這一點非常流暢..
任何想法?
我使用的是Linux Mint的(17.2 x64),已提高1.59與cmake的使用它,像這樣:
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.36.0 COMPONENTS system thread shared_ptr)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
else()
message("can not find boost")
endif()
感謝。
我跑''。bootstrap.sh'沒有'--prefix'(因爲默認位置對我來說足夠好),我下載了http:/ /sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz這應該是好的薄荷。從stage/lib中刪除所有'* .a'文件不會改變任何內容。它似乎不喜歡我要求調試和發佈 –
啊是的,沒有發現!我不認爲你可以要求它將它同時編譯爲debug和release。 如果你想這樣做,我會建議建立升壓兩次,並安裝到兩個不同的目錄,所以你可以選擇你想爲喜歡哪一個,當你需要它。混合調試和發佈代碼是一種不好的做法。 – Samidamaru
但是,這是[庫命名]點(http://www.boost.org/doc/libs/1_59_0/more/getting_started/unix-variants.html#library-naming)沒有?所以我可以有不同的lib版本 –