c++ - Boost log, GCC 4.4 and CMake -


i trying simple boost.log example running on linux using gcc 4.4.5, cmake 2.8.2 , boost 1.53.0.

compiling boost , boost log succeeded, keep getting issues when linking test program boost.log.

i use following cmakelists.txt file:

cmake_minimum_required(version 2.8)  project(quantibboostlogtest)  # include boost headers set(boost_use_static_libs on) set(boost_use_multithreaded on) find_package(threads) find_package(boost 1.53.0 components thread date_time filesystem system log log_setup required) if(boost_found)   include_directories( ${boost_include_dirs} )   link_libraries(${cmake_thread_libs_init} ${boost_libraries}) else(boost_found)   message(fatal_error "cannot build quantib boost log test without boost. please set boost_dir.") endif(boost_found)  add_executable(quantibboostlogtest boost_log_test.cxx) install(targets quantibboostlogtest destination .) 

cmake detect boost libraries correctly, still linker errors, of form:

core.cpp:(.text+0x1b0e): undefined reference `boost::detail::get_tss_data(void const*)' 

i link thread libraries. know how solve this?

it seems boost.log depends on boost.thread library need change order of libraries. see why link order matter

try following order

find_package(boost 1.53.0 components log log_setup thread date_time filesystem system required) 

if not try include them 2 times following

link_libraries(${cmake_thread_libs_init} ${boost_libraries} ${boost_libraries}) 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -