我已经下载了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版本 –