gpt4 book ai didi

c++ - 对 boost::filesystem::path_traits::convert 的 undefined reference

转载 作者:搜寻专家 更新时间:2023-10-31 02:14:50 26 4
gpt4 key购买 nike

我正在尝试使用 cmake 编译程序,并看到以下链接器错误:

/home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so: undefined reference to boost::filesystem::path_traits::convert(wchar_t const*, wchar_t
const*, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t>
const&)' /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so:
undefined reference to
boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string, std::allocator >&)'

ninja 的链接器命令生成的看起来像这样:

g++ -pthread -DBOOST_ALL_DYN_LINK
utility/test/CMakeFiles/utilityTest.dir/loadCSVTests.cpp.o utility/test/CMakeFiles/utilityTest.dir/main.cpp.o utility/test/CMakeFiles/utilityTest.dir/randomDeviceTests.cpp.o -o utility/test/utilityTest -rdynamic /home/quant/bin/boost_1_61_0/stage/lib/libboost_thread.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_program_options.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_serialization.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_unit_test_framework.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_system.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_filesystem.so utility/lib/libutilityLib.a utility/testLib/libutilityTestLib.a utility/lib/libutilityLib.a /home/quant/bin/boost_1_61_0/stage/lib/libboost_thread.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_program_options.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_serialization.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_unit_test_framework.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_system.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_filesystem.so -Wl,-rpath,/home/quant/bin/boost_1_61_0/stage/lib

如您所见,我正在链接 boost_filesystemboost_system ,因此它与 this SO post 中引用的问题不同(还有许多其他人喜欢它)。

我正在使用 boost 1.61 ,我用 gcc 5.3 编译的(与我用来编译程序的编译器相同)。

我做错了什么?

最佳答案

我有一个类似的问题,这可能是因为从 gcc 5.1 引入了一个新的 ABI。

https://github.com/openframeworks/openFrameworks/issues/4203

我通过将“add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)”添加到 CMakeLists.txt 来修复我的问题

关于c++ - 对 boost::filesystem::path_traits::convert 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39475716/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com