Skip to content

undefined reference to boost::system::system_category() & BOOST_ERROR_CODE_HEADER_ONLY #132

@blockspacer

Description

@blockspacer

Platform:
Ubuntu 18.04 with

sudo add-apt-repository ppa:boost-latest/ppa
sudo apt-get update && sudo apt-get upgrade
aptitude search boost # 1.67
sudo apt-get install libboost-dev

Version:

# release_1_0_prep
cmake .. -DJINJA2CPP_DEPS_MODE=external-boost -DJINJA2CPP_EXTRA_LIBS=boost_system
cmake --build . --target all

Error:

undefined reference to boost::system::system_category()

Possible solution (BOOST_ERROR_CODE_HEADER_ONLY):

target_compile_definitions(${LIB_TARGET_NAME} PUBLIC variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD BOOST_SYSTEM_NO_DEPRECATED BOOST_ERROR_CODE_HEADER_ONLY)
# ...
target_link_libraries(jinja2cpp_tests gtest gtest_main nlohmann_json ${LIB_TARGET_NAME} ${EXTRA_TEST_LIBS} boost_system )

see https://stackoverflow.com/questions/9723793/undefined-reference-to-boostsystemsystem-category-when-compiling/30877725#30877725

Note that BOOST_ERROR_CODE_HEADER_ONLY solves problem, but not BOOST_SYSTEM_NO_DEPRECATED

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions