How do I specify, which version of boost library to link to?(如何指定要链接到哪个版本的 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!
这篇关于如何指定要链接到哪个版本的 boost 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何指定要链接到哪个版本的 boost 库?


基础教程推荐
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 这个宏可以转换成函数吗? 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30