无法链接提升日志记录代码

时间:2016-06-13 21:04:40

标签: c++ linux boost

这似乎与此问题相同:

boost_log example with sinks fails to compile

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

  

/ usr / bin / c ++ -g
  拓扑/测试/ 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
  拓扑/测试/ CMakeFiles / topologyTest.dir / activatorTests.cpp.o   拓扑/测试/ CMakeFiles / topologyTest.dir / main.cpp.o   拓扑/测试/ CMakeFiles / topologyTest.dir / neuronTests.cpp.o   拓扑/测试/ 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:未定义的引用   符号'_ZN5boost6detail12get_tss_dataEPKv'   /usr/local/lib/libboost_thread.so:错误添加符号:DSO丢失   从命令行collect2:错误:ld返回1退出状态

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

我正在使用ubuntu 16.04

我有点失落。任何想法我缺少什么/如何诊断?

1 个答案:

答案 0 :(得分:1)

尝试与if ($_POST) { // user has submitted the form // get the form field values $userEmail = $_POST['userEmail']; // more fields... // validate the values // prepare the sql statements // execute insert statement here }

相关联

-lboost_thread更改为-DBOOST_LOG_DYN_LINK