c++ - Boost 库和 Visual Studio 2013

标签 c++ visual-studio-2012 boost visual-studio-2013

我已经通过命令行(命令提示符)使用 MSVC 工具集安装了 boost。

现在,我想知道应该在我的项目属性中包含哪些目录。

自从我将以下行添加到我的项目中:

#include <filesystem\fstream.hpp>

它抛出以下错误:

1>c:\boost\boost_1_56_0\boost\filesystem\fstream.hpp(15): fatal error C1083: 
Cannot open include file: 'boost/config.hpp': No such file or directory

我已将以下内容添加到我的库的项目属性目录中:

C:\boost\boost_1_56_0\boost
C:\boost\boost_1_56_0\stage\lib

这是我添加上述路径的地方:

(Project->Properties->VC++ Directories->Library Directories

最佳答案

不要将 boost 子目录添加到搜索路径;添加父级

C:\boost\boost_1_56_0

并在包含 header 时指定 boost 目录

#include <boost/filesystem/fstream.hpp>   // Better to use / not \ for portability

Boost header 像这样相互包含(路径中有 boost/),所以现在也可以找到它们。

关于c++ - Boost 库和 Visual Studio 2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25616679/

相关文章:

c++ - 清除 __m128i 的高位字节

asp.net-mvc - Visual Studio 在 razor 语句中显示语法错误但有效

c++ - 如何找出lambda的自动类型参数中的哪些方法?

c++ - boost::optional 对 bool 的隐式转换消失了吗?

c++ - 使用智能指针作为类成员

c++ - vec4 类型的 gltf 动画不是四元数吗?

c++ - 调用列表中子对象方法的最佳方法?

c++ - (c++) 需要帮助为我的类 Polynomial 重载 operator+

visual-studio-2012 - TFS:无法创建映射

用于存储排序的唯一值的 C++ 容器,具有不同的谓词以实现排序和唯一性