我通过这个添加上去:CMake的:未定义参考Boost库
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
project(APP C CXX)
add_executable(APP src.cpp)
target_link_libraries(APP ${Boost_LIBRARIES})
当我编译源,我得到:
demo.cpp:(.text+0x3d3): undefined reference to `boost::system::generic_category()'
我检查拼写(Boost_LIBRARIES VS BOOST_LIBRARIES),但它的确定。
我使用package boost-devel在Fedora中安装了boost。
是什么'$ {Boost_LIBRARIES}'的内容? – Hayt
它应该是静态提升lib的路径(https://cmake.org/cmake/help/v3.0/module/FindBoost.html) – Seraph
没有“一个”静态提升lib。你能打印它,而不是它“应该”? – Hayt