I am using linux and my CMakeList.txt file is
cmake_minimum_required(VERSION 2.8) set(Boost_INCLUDE_DIR /usr/local/include) set(Boost_LIBRARY_DIR /usr/local/lib) set(CMAKE_CXX_FLAGS "-lboost_program_options") find_package(Boost 1.55 COMPONENTS system program_options filesystem REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) if(NOT Boost_FOUND) message(FATAL_ERROR "boost not found") endif() add_executable(main main.cpp) target_link_libraries( main ${Boost_LABRARIES} ) and i am getting the following errors. I am working on it from two days and now i am sick of it . Can any body help me please.cmake_
Errors:
main.cpp:(.text+0x1d): undefined reference to `boost::program_options::options_description::m_default_line_length' main.cpp:(.text+0x28): undefined reference to `boost::program_options::options_description::m_default_line_length' main.cpp:(.text+0x6a): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)' collect2: error: ld returned 1 exit status make[2]: *** [main] Error 1 make[1]: *** [CMakeFiles/main.dir/all] Error 2 make: *** [all] Error 2