问题描述
Visual Studio 让我发疯,我怀疑我做错了什么.
Visual Studio drives me crazy and I am suspecting I am doing something wrong.
这就是我所做的:我很久以前安装了 Visual Studio (Pro '08),我安装了 Windows SDK (Win 7 x64),有人通过电子邮件向我发送了一个项目,但它无法构建.
This is what I do: I installed Visual Studio (Pro '08) a long time ago, I installed the Windows SDK (Win 7 x64), someone emails me a project, it fails to build.
总是找不到windows.h.虽然在每个项目的项目设置中包含 C:Program FilesMicrosoft SDKsWindowsv7.0Include
很容易,但我觉得这可能不是正确的方法做吧.有没有办法让 Visual Studio 全局感知这些文件?
我还尝试将上述目录包含在 path
变量中,但这并没有改变任何东西.
Invariably, it can not find windows.h. While it is easy enough to include C:Program FilesMicrosoft SDKsWindowsv7.0Include
in the project settings of every single project, I feel that this may not be the proper way to do it. Is there a way to somehow make Visual Studio globally aware of these files?
I also tried to include the above directory in the path
variable but that didn't change anything.
另外,它会在同一目录中随机找到windows.h而不是winresrc.h.
Also, it will randomly find windows.h but not winresrc.h in the same directory.
是我机器的问题.不知何故,Visual Studio 认为我的 Windows SDK 放错了地方.请参阅已接受的答案和修复评论.
It was a problem with my machine. Somehow, Visual Studio thought that my Windows SDK was in the wrong place. See accepted answer and comments for the fix.
推荐答案
此答案仅适用于 Visual Studio 的旧版本 - 请参阅现代版本的最新答案.
您可以在此处设置 Visual Studio 的全局包含路径:
You can set Visual Studio's global include path here:
Tools
/Options
/Projects and Solutions
/VC++ 目录
/包含文件
这篇关于包含路径如何在 Visual Studio 中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!