我使用'5.3.4 Invoke b2'通读了boost文档,并跟进了论坛帖子,解释了将boost库链接到头文件和链接器目录的细节,在boost帮助'4.1 Build From the Visual Studio IDE'中,并找到了解释bjam.exe 控件的这个很酷的 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 库,并发现关于将这些放置在何处的说明相互矛盾:
- 没有说“x64 用户注意事项:将 address-model=64 选项添加到 bjam(在线程参数之后),以便使用 64 位编译器构建静态库。”
- 找不到链接,但有人说将 x64 库放在 vs2008 垃圾箱中?
另外,我尝试将 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 调用中?