如何指定要链接到哪个版本的 boost 库?
我正在尝试将用 VS2012 编写的项目迁移到 VS2013.
I'm trying to migrate a project written in VS2012 to VS2013.
我成功编译了 boost 1.53.0(我第一次尝试了 1.54.0,但遇到了一些编译器错误)并得到了类似的库libboost_filesystem-vc120-mt-1_53.lib
.
I successfully compiled boost 1.53.0 (I first tried 1.54.0, but got some compiler errors) and got libraries like
libboost_filesystem-vc120-mt-1_53.lib
.
但是在尝试构建我的项目时,链接器抱怨:
But when trying to build my project, the linker complains:
error LNK1104: cannot open file 'libboost_filesystem-vc110-mt-1_53.lib'
我一直在我的整个解决方案中寻找一些项目设置来找出为什么它试图加载旧的库版本,但我没有找到任何东西.
I've been looking for some project settings in my entire solution to find out, why it's trying to load the older library version, but I didn't find anything.
链接器如何知道使用哪个库?我该如何解决我的问题?
How does the linker know, which library to use? And how can I fix my problem?
推荐答案
我在 TheArtTrooper 对此线程的回答中找到了我的问题的答案和解决方案:
I found the answer to my question and the solution to my problem in TheArtTrooper's answer to this thread:
我如何使用新的Visual Studio 2013 预览版?
链接器确实知道要使用哪个库,因为它在 boost/config/auto_link.hpp 中指定.
The linker does know which library to use, because it is specified in boost/config/auto_link.hpp.
这个文件少了几行代码来处理vc120版本:
This file is missing a few lines of code to handle the vc120 version:
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1800)
// vc11:
# define BOOST_LIB_TOOLSET "vc110"
# elif defined(BOOST_MSVC)
// vc12:
# define BOOST_LIB_TOOLSET "vc120"
现在它可以编译和链接了!
Now it compiles and links just fine!
相关文章