【发布时间】:2013-03-06 20:32:37
【问题描述】:
我使用“5.3.4 Invoke b2”阅读了boost documentation,并跟进了论坛帖子,这些帖子解释了将boost库链接到header and linker directories的详细信息,在boost帮助“4.1 Build From the Visual Studio IDE',并找到了解释 bjam.exe controls 的这个很酷的 boost 相关 wiki。
将#include <boost/thread/thread.hpp>放在main.cpp中
而且,我收到此链接器错误,现有的帮助线程已确定问题出在 x64:
错误:
error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category@system@boost@@YAXXZ) main.obj
error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ) main.obj
它们是相似的,关于'posix_category' 和关于'native_ecat' 的一些东西
所以,我尝试构建 x64 boost 库,但在放置这些库的位置上发现了相互矛盾的说明:
- 没说"Note for x64 users: Add the address-model=64 option to bjam (after the threading argument) in order to build static libs with the 64-bit compiler."
- 找不到链接,但有人说将 x64 库放在 vs2008 的 bin 中?
另外,我尝试将 vs2008 配置改回 x32 -> solutionExplorer/solution_properties/configuration_manager/active_solution_platform - Win32,关闭并重新打开 Visual Studio - 将附加目录 C/C++/general 和 Linker/general 重新链接到 Boost/root 和Boost/stage/lib - 它编译没有错误。
我对 b2 命令的最佳猜测是 --toolset=msvc-9.0 address-model=64 --build-type=complete --stagedir=lib\x64 stage
请简要说明如何在 VS2008 上构建和安装 x64 版本的 boost。此外,wiki 谈论的发布和调试是什么 - 它们不在 Boost invocation 中?
【问题讨论】:
-
有什么理由使用安装说明中的 5.3 而不是“5.2 Simplified Build From Source”?
-
@us2012 没什么特别的 - 我看到了但不确定它是什么,它前面是“5.1 Install Visual Studio Binaries”并谈到不再生产安装的“BoostPro Computing”,所以我可能跳过了它,然后去了看起来像我读过的关于 bjam.exe 的大多数帮助线程 - 很公平......
-
我并不是说它会解决你的问题,但由于它是完全自动化的并且超级好用,我建议你至少尝试一下。
-
是的,但让我担心的是超级自动化和超级简单的部分。我安装了 VS 2005、2010 和 beta 2011,在早期安装中导致自动化和简单的方法变得复杂和令人费解:)
-
我在使用 boost 自动链接时遇到了这个问题,并通过添加 #include <..> 来修复它