如何在Visual Studio中包含路径? [英] How do include paths work in Visual Studio?

查看:144
本文介绍了如何在Visual Studio中包含路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 Files \ MicroSoft SDKs \ Windows \v7.0 \ include ,我觉得这可能不是正确的方法。有没有办法以某种方式使Visual Studio全局知道这些文件?

我也尝试将上述目录包含在路径变量中但是没有不改变任何东西。

Invariably, it can not find windows.h. While it is easy enough to include C:\Program Files\Microsoft SDKs\Windows\v7.0\Include 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的全局包含路径:

You can set Visual Studio's global include path here:

工具 / 选项 / 项目和解决方案 / VC ++目录 / 包含文件

Tools / Options / Projects and Solutions / VC++ Directories / Include files

UPDATE(在Visual Studio 2015中):

UPDATE (in Visual Studio 2015):

这篇关于如何在Visual Studio中包含路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆