Boost.Log linking errors under GNU/Linux

前端 未结 2 1579
刺人心
刺人心 2021-02-04 10:59

I would like to test the Boost.Log library. Unfortunately, I get link errors.

I use Arch Linux, and I installed Boost headers and libraries via built-in package manager

相关标签:
2条回答
  • 2021-02-04 11:01

    You need to define BOOST_LOG_DYN_LINK:

    g++ -DBOOST_LOG_DYN_LINK blog.cpp -lboost_log -lpthread
    
    0 讨论(0)
  • 2021-02-04 11:21

    If you are using cmake then:

    find_package(Boost REQUIRED COMPONENTS system log)
    target_link_libraries(credential ${Boost_SYSTEM_LIBRARY} ${Boost_LOG_LIBRARY})
    

    and use:

    #define BOOST_LOG_DYN_LINK 1
    
    0 讨论(0)
提交回复
热议问题