C++ Intellisense 无法打开源文件“*.h”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17039251/
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
Intellisense cannot open source file "*.h"
提问by SpicyWeenie
I have no idea as to what may have happened. I was removing a few libraries I added to the VC folder and from Additional Dependencies (OpenGL libraries I've added), then when I tried to compile my program, I received 100 errors. The problem is that my current project is not recognizing some of the standard headers. Here is what I've got:
我不知道可能发生了什么。我正在删除一些我添加到 VC 文件夹和附加依赖项(我添加的 OpenGL 库)的库,然后当我尝试编译我的程序时,我收到了 100 个错误。问题是我当前的项目无法识别某些标准标题。这是我所拥有的:
#include <Windows.h> <-----Error from title
#include <stdio.h> <-----Error from title
#include <stdlib.h> <-----Error from title
#include "stdafx.h" <-----OK
#include <CommCtrl.h> <-----Error from title
I've created a new project to compare it's properties, but didn't notice anything missing. Does anyone have an idea as to why project isn't using these headers?
我创建了一个新项目来比较它的属性,但没有发现任何遗漏。有没有人知道为什么项目不使用这些标题?
回答by raj raj
Make sure you have all these paths under VC++ directories
->Include Directories
:
确保您在VC++ directories
->下拥有所有这些路径Include Directories
:
$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);??
$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);??
回答by philMacU
Just an update on previous answer, in VS2015, the previous method of including directories has been deprecated. Its now done on a per-solution basis. In the solution explorer right click your Project Name, then select properties, the dialog that opens up is similar to older VS. Add the paths as suggested above to the include directories and away you go.
只是对先前答案的更新,在 VS2015 中,先前的包含目录的方法已被弃用。它现在是在每个解决方案的基础上完成的。在解决方案资源管理器中右键单击您的项目名称,然后选择属性,打开的对话框类似于旧版 VS。将上面建议的路径添加到包含目录中,然后就可以了。