gpt4 book ai didi

c++ - 无法链接 boost 日志记录代码

转载 作者:太空宇宙 更新时间:2023-11-04 09:24:41 25 4
gpt4 key购买 nike

这似乎是与这个问题相同的问题:

boost_log example with sinks fails to compile

但是,添加 -lpthread 似乎没有任何效果。这是我用来编译的完整命令行:

/usr/bin/c++ -g
topology/test/CMakeFiles/topologyTest.dir/main.cpp.o topology/test/CMakeFiles/topologyTest.dir/configTests.cpp.o -o topology/test/topologyTest -rdynamic -lboost_log -lboost_log_setup -lboost_thread -lboost_program_options -lboost_serialization -lboost_unit_test_framework -lboost_filesystem -lboost_system -lboost_date_time -lboost_regex -lboost_chrono -lboost_atomic -lpthread topology/lib/libtopologyLib.a topology/testLib/libtopologyTestLib.a utility/testLib/libutilityTestLib.a topology/lib/libtopologyLib.a -lpthread -lboost_log -lboost_log_setup -lboost_thread -lboost_program_options -lboost_serialization -lboost_unit_test_framework -lboost_filesystem -lboost_system -lboost_date_time -lboost_regex -lboost_chrono -lboost_atomic -lpthread expression/lib/libexpressionLib.a utility/lib/libutilityLib.a

我也尝试使用定制的 1.60 版本的 boost;

/usr/bin/g++ -g
topology/test/CMakeFiles/topologyTest.dir/activatorTests.cpp.o topology/test/CMakeFiles/topologyTest.dir/main.cpp.o topology/test/CMakeFiles/topologyTest.dir/neuronTests.cpp.o topology/test/CMakeFiles/topologyTest.dir/speciesTests.cpp.o topology/test/CMakeFiles/topologyTest.dir/synapseTests.cpp.o -o topology/test/topologyTest -rdynamic -lpthread /usr/local/lib/libboost_log.so /usr/local/lib/libboost_log_setup.so /usr/local/lib/libboost_serialization.so /usr/local/lib/libboost_system.so /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_unit_test_framework.so /usr/local/lib/libboost_date_time.so /usr/local/lib/libboost_filesystem.so /usr/local/lib/libboost_regex.so /usr/local/lib/libboost_chrono.so /usr/local/lib/libboost_atomic.so -lpthread topology/lib/libtopologyLib.a topology/testLib/libtopologyTestLib.a utility/testLib/libutilityTestLib.a topology/lib/libtopologyLib.a -lpthread /usr/local/lib/libboost_log.so /usr/local/lib/libboost_log_setup.so /usr/local/lib/libboost_serialization.so /usr/local/lib/libboost_system.so /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_unit_test_framework.so /usr/local/lib/libboost_date_time.so /usr/local/lib/libboost_filesystem.so /usr/local/lib/libboost_regex.so /usr/local/lib/libboost_chrono.so /usr/local/lib/libboost_atomic.so -lpthread expression/lib/libexpressionLib.a utility/lib/libutilityLib.a -Wl,-rpath,/usr/local/lib

在这两种情况下,我得到的错误是:

/usr/bin/ld: /usr/local/lib/libboost_log.so: undefined reference to symbol '_ZN5boost6detail12get_tss_dataEPKv' /usr/local/lib/libboost_thread.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

我尝试将 -DBOOST_LOG_DYN_LINK 附加到命令但没有效果。

我正在使用 ubuntu 16.04

我有点不知所措。知道我遗漏了什么/如何诊断吗?

最佳答案

尝试与-lboost_thread链接,

-DBOOST_LOG_DYN_LINK更改为-DBOOST_ALL_DYN_LINK

关于c++ - 无法链接 boost 日志记录代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37799089/

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