Andrey thanks for your reply. I tried that as well without success. My cmake file is below: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") add_definitions(-DBOOST_LOG_DYN_LINK=1) ## Common parameters. # Set common path variables. (YOURS MAY BE DIFFERENT) set(BOOST_ROOT "$ENV{BOOST_ROOT}") set(ARMADILLO_HOME "$ENV{ARMADILLO_ROOT}") include_directories (${ARMADILLO_HOME}/include) link_directories (${ARMADILLO_HOME}/lib64) #SET(CMAKE_VERBOSE_MAKEFILE ON) # Set the path to Boost #SET(Boost_USE_STATIC_LIBS ON) #SET(Boost_USE_MULTITHREADED ON) find_package (Boost COMPONENTS log log_setup system thread filesystem date_time REQUIRED) include_directories (${Boost_INCLUDE_DIRS}) link_directories (${Boost_LIBRARY_DIRS}) #link_libraries(${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/modules") # Retrieve the list of source files. file (GLOB SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) file (GLOB MODULE_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/modules/*.cpp) add_executable (main main.cpp ${SOURCE} ${MODULE_SOURCE} ) target_link_libraries(main boost_log) target_link_libraries (main ${Boost_LIBRARIES} -lpthread) On Tue, Sep 15, 2020 at 12:14 PM Andrey Semashev via Boost < boost@lists.boost.org> wrote:
On 9/15/20 5:34 PM, Karmethia Thompson via Boost wrote:
Good morning,
I am trying to create a logger that uses Boost Log. I was successful getting my code to compile with 1.63.0, so I know that I am not too far off of the mark. cmake/make throws a linking issues whenever I attempt to create a sink:
[snip]
Can someone please help? I have tried everything from trying to dynamically and statically link. I've added both "log" and "log_setup" to the find_packages in cmake and have also explicitly specified the locations of those libraries as well.
The error messages indicate you're missing symbols defined in libboost_log.
I think you either didn't specify the library to link with, or you might be affected by this bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/20638 https://github.com/boostorg/log/issues/46
The solution is to use target_link_libraries to explicitly link with libboost_log, e.g.:
target_link_libraries(${MY_TARGET} boost_log)
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Karmethia Thompson Applied Mathematics, PhD