使用仅标头的库时增强链接器错误 [英] Boost linker errors when using header-only libraries

查看:118
本文介绍了使用仅标头的库时增强链接器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Boost 1.53.0的以下组件与C ++ 11库结合使用...

I am using the following components of Boost 1.53.0 in conjunction with C++11 libraries...

  • boost :: signals2 :: scoped_connection
  • boost :: signals2 :: signal
  • boost :: signals2 :: connection
  • boost :: math :: constants
  • boost :: circular_buffer
  • boost :: lexical_cast

根据此答案,我不需要链接库使用Boost的这些部分.根据此答案,signals2应该为标头-也只有.但是,我仍然收到链接器错误...

According to this answer, I do not need to link against libraries to use these parts of Boost. According to this answer, signals2 should be header-only also. However, I still receive linker errors...

Undefined symbols for architecture i386:
  "boost::system::system_category()", referenced from:
  ___cxx_global_var_init2 in Main.o
  ...
  "boost::system::generic_category()", referenced from:
  ___cxx_global_var_init in Main.o
  ___cxx_global_var_init1 in Main.o
  ...

为什么?

推荐答案

问题是虚假的

#include <boost/thread/mutex.hpp>

偶然留在文件中间.

这篇关于使用仅标头的库时增强链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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