一、今日在ubuntu18系统上使用boost库编写程序,由于忽略了cmake中的配置,导致编译失败如下图所示:
二、解决办法是在CMakeLists.txt文件中添加如下语句,完美解决:
find_package(Boost COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
target_link_libraries(init
${Boost_LIBRARIES})