Cmake + Boost 1.71 Undefined Reference в самой библиотеке - PullRequest
0 голосов
/ 24 октября 2019

Я использую CMAKE для создания своего проекта:

cmake_minimum_required(VERSION 3.14)
 set (CMAKE_CXX_STANDARD 11)
 project(saryxo_checker)
 find_package( OpenCV REQUIRED )
 find_package( Boost 1.71 REQUIRED COMPONENTS program_options filesystem system )

 set(SOURCE_FILES 
    ${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
    ${CMAKE_CURRENT_LIST_DIR}/src/FeatureEvaluator.cpp
    ${CMAKE_CURRENT_LIST_DIR}/src/Converter.cpp
    ${CMAKE_CURRENT_LIST_DIR}/core/util.cpp)
 include_directories(
    ${CMAKE_CURRENT_LIST_DIR}/include
    ${CMAKE_CURRENT_LIST_DIR}/core
    ${OpenCV_INCLUDE_DIR}
    ${Boost_INCLUDE_DIR})

 add_executable(saryxo_checker ${SOURCE_FILES})
 target_link_libraries(saryxo_checker ${OpenCV_LIBS} ${Boost_LIBRARIES})

Однако, он выдает ошибку во время компоновки. Ошибки выбрасываются ВНУТРИ Boost.

 [ 20%] Linking CXX executable saryxo_checker
 CMakeFiles/saryxo_checker.dir/src/main.cpp.o: In Function »__static_initialization_and_destruction_0(int, int)«:
 /usr/local/include/boost/system/error_code.hpp:221: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:222: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:223: Warning: undefined reference to »boost::system::system_category()«
 CMakeFiles/saryxo_checker.dir/src/main.cpp.o: In function »boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)«:
 /usr/local/include/boost/program_options/detail/parsers.hpp:44: Warning: undefined reference to »boost::program_options::detail::cmdline::cmdline(std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)«
 CMakeFiles/saryxo_checker.dir/src/main.cpp.o:(.data.rel.ro._ZTVN5boost15program_options11typed_valueIicEE[_ZTVN5boost15pro ram_options11typed_valueIicEE]+0x40): Warning: undefined reference to »boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const«
 CMakeFiles/keypoint_tracker_evaluator_saryxoS_Trian.dir/src/main.cpp.o:(.data.rel.ro._ZTVN5boost15program_options11typed_valueIjcEE[_ZTVN5boost15program_options11typed_valueIjcEE]+0x40): Warning: undefined reference to »boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const«
 CMakeFiles/saryxo_checker.dir/src/main.cpp.o:(.data.rel.ro._ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE[_ZTVN5boost15program_options11typed_valueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEE]+0x40): Warning: undefined reference to »boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const«
 CMakeFiles/saryxo_checker.dir/src/main.cpp.o: In function »boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::xparse(boost::any&, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const«:
 /usr/local/include/boost/program_options/detail/value_semantic.hpp:167: Warning: undefined reference to »boost::program_options::validate(boost::any&, std::__debug::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int)«
 CMakeFiles/saryxo_checker.dir/src/FeatureEvaluator.cpp.o: In function »__static_initialization_and_destruction_0(int, int)«:
 /usr/local/include/boost/system/error_code.hpp:221: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:222: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:223: Warning: undefined reference to »boost::system::system_category()«
 CMakeFiles/saryxo_checker.dir/src/Converter.cpp.o: In function »__static_initialization_and_destruction_0(int, int)«:
 /usr/local/include/boost/system/error_code.hpp:221: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:222: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:223: Warning: undefined reference to »boost::system::system_category()«
 CMakeFiles/saryxo_checker.dir/src/Converter.cpp.o: In function »boost::system::error_code::error_code()«:
 /usr/local/include/boost/system/error_code.hpp:322: Warning: undefined reference to »boost::system::system_category()«
 CMakeFiles/saryxo_checker.dir/src/Converter.cpp.o: In function »boost::system::error_code::clear()«:
 /usr/local/include/boost/system/error_code.hpp:350: Warning: undefined reference to »boost::system::system_category()«
 CMakeFiles/saryxo_checker.dir/core/util.cpp.o: In in function »__static_initialization_and_destruction_0(int, int)«:
 /usr/local/include/boost/system/error_code.hpp:221: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:222: Warning: undefined reference to »boost::system::generic_category()«
 /usr/local/include/boost/system/error_code.hpp:223: Warning: undefined reference to »boost::system::system_category()«
 collect2: error: ld returned 1 exit status
 CMakeFiles/saryxo_checker.dir/build.make:179: recipe for target 'saryxo_checker' failed
 make[3]: *** [saryxo_checker] Error 1
 CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/saryxo_checker.dir/all' failed
 make[2]: *** [CMakeFiles/saryxo_checker.dir/all] Error 2
 CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/saryxo_checker.dir/rule' failed
 make[1]: *** [CMakeFiles/saryxo_checker.dir/rule] Error 2
 Makefile:118: recipe for target 'saryxo_checker' failed
 make: *** [saryxo_checker] Error 2

Я пытался создать boost в режиме отладки, так как я также собираю свою программу в режиме отладки, но ошибка остается той же. Что бы это могло быть?

  • ОС: Ubuntu 18.04
  • CMake: 3.14
  • Повышение 1.71
...