c++ - link to boost::thread fails -
i'm trying install program called mgiza. compiles cmake , requires boost libraries. used commands
cmake . make
when run 'make' following errors:
d4norm.cxx:(.text+0x95b): undefined reference `boost::system::generic_category()'
and likes. inserted following line in cmakelists.txt:
find_package( boost 1.41 components system)
it worked because more files compiled , warning above disappeared, got warnings:
main.cpp:(.text+0x7174): undefined reference `boost::thread::hardware_concurrency()'
although have find_package( boost 1.41 components thread) in cmakelists. doing wrong?
you need search thread component:
find_package(boost 1.41 components thread system)
in newer versions of boost.thread should link against boost.chrono
find_package(boost components thread chrono system)
then need link executable against , add includes:
# check if worked out if(boost_found) add_executable(main main.cpp) # executable or library or whatever target_link_libraries(main ${boost_libraries}) target_include_directories(main ${boost_include_dirs}) else() # panic endif()
Comments
Post a Comment