C++ 致命错误 C1083:无法打开包含文件:'boost/config.hpp':没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3482592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 12:56:04  来源:igfitidea点击:

fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory

c++boostinclude

提问by Ahmed

I think I did all the necessary configuration but I am still getting this:

我想我做了所有必要的配置,但我仍然得到这个:

Error 1 fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory    File:c:\documents and settings\administrator\my documents\visual studio 2008\libs\boost_1_43_0\boost\smart_ptr\shared_ptr.hpp Line:17

Here are screenshots of setting I have done to add directories for include and lib files :

以下是我为包含和 lib 文件添加目录所做的设置屏幕截图:

1

1

2

2

3

3

Am I missing something ?

我错过了什么吗?

回答by Ahmed

I finally found the answer :) and I will write it here to help.

我终于找到了答案:),我会写在这里以提供帮助。

Project>"YOURPROJECT" Properties>C/C++>General>Additional Include Directoriesthen select where you downloaded your library . This worked and all the above didn't, so make sure not to forget it .

Project>"YOURPROJECT" Properties>C/C++>General>Additional Include Directories然后选择下载库的位置。这行得通,但以上所有都没有,所以请确保不要忘记它。

回答by Andy

I installed boost from the installer. It installs the library in c:\program files\boost.

我从安装程序安装了 boost 。它将库安装在 c:\program files\boost 中。

Add the directory to your project's properties like the below

将目录添加到项目的属性中,如下所示

enter image description here

在此处输入图片说明

回答by rawel

For me, I was building targeting the win32 platform. Changing to x64 worked.

对我来说,我正在构建针对 win32 平台。更改为 x64 有效。

回答by Murali Krishna M.

Please note that you need to add the path of "boost" directory in both 64bit and 32bit configurations. While adding the path, make sure to select appropriate platform (64bit or 32bit) depending upon your need. If you compile in both versions, you need add both.

请注意,在 64 位和 32 位配置中都需要添加“boost”目录的路径。添加路径时,请确保根据需要选择合适的平台(64 位或 32 位)。如果在两个版本中编译,都需要添加。

Boost library directory is valid for both the above configurations.

Boost 库目录对上述两种配置都有效。

回答by izzaki

mmake sure you are not looking at boost-system instead of boost-filesystem

确保您不是在看 boost-system 而不是 boost-filesystem

回答by vishaluc

Add the namespace after all headers:

在所有标头之后添加命名空间:

using namespace std;

removing from the header (.h) did the trick.

从标题(.h)中删除就可以了。

remove all the ".h" from all headers. Should work.

从所有标题中删除所有“.h”。应该管用。