在我的C ++程序,我包括升压转换器的filesystem
和regex
头,最终线程支持。 我想cmake
和clang
在构建时对他们进行链接。
我收到以下错误:
[100%] Building CXX object CMakeFiles/a.out.dir/src/main.cpp.o
Linking CXX executable a.out
/usr/bin/ld: CMakeFiles/a.out.dir/src/main.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/libboost_system.so.1.56.0: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我相信我已经列入我CmakeList文件进行必要的联系和标志,但我必须缺少订单或链接的标志。 我已经失去了,因为很多这样的头发。
的CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(TARGET_NAME "a.out")
project(${TARGET_NAME} C CXX)
file(GLOB ALL_SRC_FILES "src/*.cpp")
add_definitions("-std=c++11 -Wall -g -pthread")
find_package(Boost 1.56 COMPONENTS filesystem regex REQUIRED)
message(status ": Boost Include: ${Boost_INCLUDE_DIR}")
message(status ": Boost Libraries Dir: ${Boost_LIBRARY_DIRS}")
message(status ": Boost Libraries: ${Boost_LIBRARIES}")
include_directories(${Boost_INCLUDE_DIR})
include_directories(/usr/include/c++/4.9.1)
include_directories(/usr/lib/clang/3.5.0/include)
include_directories(src)
list(APPEND CMAKE_CXX_FLAGS "-pthread")
add_executable(${TARGET_NAME} ${ALL_SRC_FILES})
link_directories(${Boost_LIBRARY_DIRS})
target_link_libraries(${TARGET_NAME} ${Boost_LIBRARIES})