这是我所做的:
- 从 boost 网站下载 1.54 zip 文件
- 提取/复制到 C:\Program Files (x86)\Boost
- 在 Visual Studio 中,我已将包含库设置为:C:\Program Files (x86)\Boost\boost_1_54_0\boost_1_54_0\
(这似乎可以很好地让编译器接受这些库)
现在我遇到了问题-链接器:
- 在 Visual Studio 中,我已将链接器包含目录设置为:C:\Program Files (x86)\Boost\boost_1_54_0\boost_1_54_0\libs\
当我编译我的项目时,我得到:
fatal error LNK1104: cannot open file 'libboost_date_time-iw-mt-sgd-1_54.lib'
编辑使用下面的答案构建了 boost 二进制文件。但是我现在有这些文件:
libboost_date_time-vc110-1_54.lib
libboost_date_time-vc110-gd-1_54.lib
libboost_date_time-vc110-mt-1_54.lib
libboost_date_time-vc110-mt-gd-1_54.lib
libboost_date_time-vc110-mt-s-1_54.lib
libboost_date_time-vc110-mt-sgd-1_54.lib
libboost_date_time-vc110-s-1_54.lib
libboost_date_time-vc110-sgd-1_54.lib
还是没有
'libboost_date_time-iw-mt-sgd-1_54.lib'
编辑:认为我已经找到了问题:
http://lists.boost.org/Archives/boost/2004/08/70114.php
OK, here's the problem: originally we had one Intel toolset: "intel-win32" which created the library suffix "iw" (note no version number!), and this is what the auto-link header currently searches for.
However people have started adding versioned Intel toolsets, which means that we now produce an ad-hoc mixture of library names, some with compiler-version suffixes and some without, the autolink code could handle either form, but as it's not psychic it can't handle both :-(
解决方案是 #define BOOST_ALL_NO_LIB
最佳答案
在 64 位系统上,您应该在 Program Files 中构建 boost,而不是 Program Files(x86),boost 自动库包含不能正确处理重定向。或者,您可以手动管理库包含...但我强烈建议不要这样做。
同时提醒您,您需要 boost 将要使用的所有口味和比特数。参见 How to use Boost in Visual Studio 2010有关如何这样做的一个很好的例子。
- 在管理员 visual studio 命令提示符下转到 boost 目录
- 运行
bootstrap.bat
- 运行
b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64
- 等待b2完成构建
编辑:
事实证明,该库中的 iw
指的是英特尔编译器...要将其与 boost 和 visual studio 一起使用,您需要遵循 directions from Intel .
关于c++ - 我是否在 Visual Studio 中正确设置了 boost 包含和链接器路径? (提供的步骤),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19797690/