不能打开包含文件config.h。

时间:2022-06-20 02:17:45

One of the header files uses

其中一个头文件使用。

#include <config.h>

but I keep getting the error

但我一直得到误差。

Fatal error C1083: Cannot open include file: 'config.h': No such file or directory

致命错误C1083:不能打开包含文件:'config。没有这样的文件或目录。

and I don't know why. config.h is in the headers folder in the project and when I right-click on it, I can actually open the file too, but I still get this error when building the project.

我也不知道为什么。配置。h在项目的header文件夹中,当我右键点击它时,我也可以打开文件,但是在构建项目时仍然会出现这个错误。

1 个解决方案

#1


4  

That must mean the directory is not added to the extra include directories tab in the project properties. If the header is not in the same location as the source file, it doesn't matter if it's added to the project or not.

这意味着该目录没有添加到项目属性中额外的include目录选项卡中。如果消息头与源文件的位置不相同,那么是否将其添加到项目中也无关紧要。

Go to Project properties (right click on project) -> Configuration Properties -> C/C++ -> General -> Additional include directories and add the directory where the header resides (probably something like "./headers").

转到项目属性(右击项目)->配置属性-> - C/ c++ -> General ->附加包括目录,并添加标题所在的目录(可能类似于“./header”)。

#1


4  

That must mean the directory is not added to the extra include directories tab in the project properties. If the header is not in the same location as the source file, it doesn't matter if it's added to the project or not.

这意味着该目录没有添加到项目属性中额外的include目录选项卡中。如果消息头与源文件的位置不相同,那么是否将其添加到项目中也无关紧要。

Go to Project properties (right click on project) -> Configuration Properties -> C/C++ -> General -> Additional include directories and add the directory where the header resides (probably something like "./headers").

转到项目属性(右击项目)->配置属性-> - C/ c++ -> General ->附加包括目录,并添加标题所在的目录(可能类似于“./header”)。