undefined reference to `boost::program_options::options_description::m_default_line_length’

If you have installed boost from repo just use -lboost_program_options that will suffice.
If you installed boost libraries in some other library, you need to specify that directoty by -L/path/to/lib

In CMake you may specify set(CMAKE_CXX_FLAGS "-lboost_program_options")

However with CMake you should use

FIND_PACKAGE(Boost COMPONENTS program_options REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(target ${Boost_LIBRARIES})

Leave a Comment