与汇boost_log例如编译失败 [英] boost_log example with sinks fails to compile
问题描述
我是用boost_log在开头的一个项目并右键我面临以下的问题考虑。
升压日志示例,我发现在: HTTP ://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_file.cpp 无法编译。其他更简单的例子(没有汇)我编译没有问题。
G ++ -std = C ++ 11 boost_log_sinks.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lpthread
在/ usr /斌/劳工处:/tmp/ccApJdsi.o:未定义的参考符号
_ZN5boost6detail12get_tss_dataEPKv
//usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0:错误添加
符号:DSO从命令行collect2丢失:错误:LD返回1
退出状态
块引用>我在Ubuntu14.04我摹工作++版本是G ++(Ubuntu的4.8.2-19ubuntu1)4.8.2
有谁知道为什么会出现这种情况?
解决方案您必须manualy链接boost_thread:
G ++ -std = C ++ 11 boost_log_sinks.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lboost_thread -lpthread
I was considering using boost_log for one project and right at the beginning I faced following problem.
Boost Log Example I found at: http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_file.cpp fails to compile. Other simpler examples (without sinks) I compile without problems.
g++ -std=c++11 boost_log_sinks.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lpthread
/usr/bin/ld: /tmp/ccApJdsi.o: undefined reference to symbol '_ZN5boost6detail12get_tss_dataEPKv' //usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
I am working on Ubuntu14.04 my g++ version is g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Does anybody knows why is this happening?
解决方案You must link boost_thread manualy:
g++ -std=c++11 boost_log_sinks.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lboost_thread -lpthread
这篇关于与汇boost_log例如编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!