我将Boost 1.53.0的以下组件与C ++ 11库结合使用...
根据this answer,我不需要链接库来使用Boost的这些部分。根据this answer,signals2也应该只是标题。但是,我仍然收到链接器错误...
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
...
为什么?
Boost.Signals2确实只是标题,但是Boost.System is not。您必须确保您对该库没有任何依赖性。如果它在你自己的代码中,你必须构建Boost.System并链接它。如果它是从任何一个只有头的Boost库中调用的,那就是file a bug report。
问题是虚假的
#include <boost/thread/mutex.hpp>
不小心遗留在文件中间。