Undefined reference to 'boost::system::generic_category()'?

前端 未结 4 1899
执笔经年
执笔经年 2020-12-10 16:23

it seems that i am unable to see the obvious. I wanted to use some Boost library features for my project and know i am getting these nice errors all of a sudden:

4条回答
  •  -上瘾入骨i
    2020-12-10 16:47

    The "system" lib is missing in the linking stage. My config is as follows and it fixes the error:

    find_package(Boost 1.55.0 REQUIRED COMPONENTS system filesystem)
    
    include_directories(... ${Boost_INCLUDE_DIRS})
    
    link_directories(... ${Boost_LIBRARY_DIRS})
    
    target_link_libraries(... ${Boost_LIBRARIES})
    

    Note that using only

    find_package(Boost 1.55.0 REQUIRED)
    

    does not work as ${Boost_LIBRARIES} won't be available then.

提交回复
热议问题