问题描述
我是第一次开始使用 Boost,详情:
I'm just getting started with Boost for the first time, details:
- 我使用的是 Visual Studio 2008 SP1
- 我正在进行 x64 构建
- 我只使用 boost::asio(以及它具有的任何依赖项)
我的代码现在可以编译了,我将我的项目指向了 boost 库(在构建了 x64 库之后)并解决了一些简单的问题,现在我面临链接器错误:
My code now compiles, and I pointed my project at the boost libraries (after having built x64 libs) and got past simple issues, now I am facing a linker error:
2>BaseWebServer.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)" (?get_system_category@system@boost@@YAAEBVerror_category@12@XZ)
2>BaseWebServer.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_generic_category(void)" (?get_generic_category@system@boost@@YAAEBVerror_category@12@XZ)
有什么想法吗?
我添加了这个定义:#define BOOST_LIB_DIAGNOSTIC
I added this define: #define BOOST_LIB_DIAGNOSTIC
现在在我的输出中我看到了:
And now in my output I see this:
1>Linking to lib file: libboost_system-vc90-mt-1_38.lib
1>Linking to lib file: libboost_date_time-vc90-mt-1_38.lib
1>Linking to lib file: libboost_regex-vc90-mt-1_38.lib
这似乎表明它实际上是在系统库中链接.
which seems to indicate it is infact linking in the system lib.
推荐答案
我解决了这个问题.当我打算构建 64 位库时,我已经构建了 32 位库.我修正了我的构建语句,并构建了 64 位库,现在它可以工作了.
I solved the problem. I had built 32-bit libraries when I had intended to build 64-bit libraries. I fixed up my build statement, and built 64-bit libraries, and now it works.
这是我的 bjam 命令行:
Here is my bjam command line:
C:Program Files (x86)oostoost_1_38>bjam --build-dir=c:oost --build-type=complete --toolset=msvc-9.0 address-model=64 architecture=x86 --with-system
这篇关于Boost 链接器错误:未解析的外部符号 "class boost::system::error_category const &__cdecl boost::system::get_system_category(void)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!