linker - Boost with Cmake on linux(ubuntu) -
this cmakelists.txt file:
add_definitions(-std=c++11) find_package(boost 1.55.0 components filesystem required) include_directories(${boost_include_dirs}) add_executable(bst main.cpp) target_link_libraries(bst ${boost_libraries}) when execute cmake .. in build directory , cmake generates files .
but when run make in build directory following errors :
amin@aminux:~/documents/boost_test/build$ make scanning dependencies of target bst [100%] building cxx object cmakefiles/bst.dir/main.cpp.o linking cxx executable bst /usr/bin/ld: cmakefiles/bst.dir/main.cpp.o: undefined reference symbol '_zn5boost6system15system_categoryev' //usr/lib/x86_64-linux-gnu/libboost_system.so.1.55.0: error adding symbols: dso missing command line collect2: error: ld returned 1 exit status make[2]: *** [bst] error 1 make[1]: *** [cmakefiles/bst.dir/all] error 2 make: *** [all] error 2 in main.cpp source file called boost::filesystem::is_directory function testing boost .
you should add boost::system library component in cmakelists.txt file
find_package(boost 1.55.0 components filesystem system required)
Comments
Post a Comment