与汇boost_log例如编译失败 [英] boost_log example with sinks fails to compile

查看:1404
本文介绍了与汇boost_log例如编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆