编辑 $(IncludePath) “宏"在 Visual Studio 2010 中 [英] Edit $(IncludePath) "macro" in Visual Studio 2010

查看:46
本文介绍了编辑 $(IncludePath) “宏"在 Visual Studio 2010 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Visual Studio 2010 Ultimate,它显然已经为我的 Win32 C++ 包含和库导入了默认目录.我创建的每个新 Win32 C++ 项目都会自动添加旧的包含/库目录,这会破坏我的构建.

I've installed Visual Studio 2010 Ultimate and it has apparently imported the default directories for my Win32 C++ includes and libraries. Every new Win32 C++ project I create automatically adds my old include/library directories which screws up my build.

所以我的问题是: 如何在 Visual Studio 2010 中编辑 $(IncludePath)?

So my question is this: How can I edit $(IncludePath) in Visual Studio 2010?

还是 $(IncludePath) 特定于此项目并且仅是从父级或项目默认值继承"复选框的结果?(在这种情况下,问题变成:如何编辑项目默认值,因为它在 Visual Studio 选项中似乎已折旧)

谢谢!

注意:%include% 环境变量未在 Windows 中定义.如果您在 VS2010 命令提示符(不是 Windows 命令提示符)中输入echo %include%",它确实会出现,但它与我在屏幕截图中试图摆脱的值不同)

NOTE: The %include% environment variable is not defined in Windows. It does show up if you enter "echo %include%" in the VS2010 command prompt (not the Windows command prompt), but it's not the same values as what I'm trying to get rid of in the screenshots)

推荐答案

在 VS2010 中,这些路径在一个或多个属性表中指定(相应的更改在一个具有指导意义的VS 项目团队博客上的文章.您可以为每个项目自己添加这些,但该项目还包括一个指定所有默认值的项目.

In VS2010, these paths are specified in one or more property sheets (the respective changes are discussed in an instructive article on the VS Project Team Blog). You can add those yourself per-project, but the project also includes one specifying all the default values.

在我的系统上,它位于 C:\Users\\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props.

On my system it is located in C:\Users\<user>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props.

您可以通过打开 Property Manager 窗口(View->Other Windows->Property Manager)从 Visual Studio 访问它,然后双击属性表.您也可以从这个窗口中自己添加属性表(它会优先于默认的).

You can access it from Visual Studio by opening the Property Manager window (View->Other Windows->Property Manager), and then doubleclick the property sheet. You can also add property sheets yourself from this window (which will take precedence over the default one).

删除对 Microsoft.Cpp.Win32.user.props 的引用也是完全合法的.如果您需要确保项目是完全独立的,这很有用:例如,它不会从环境中获取包含路径.然后,您只需在项目本身或作为项目一部分的自定义属性表中指定路径(推荐以方便重用)

It is also perfectly legal to remove the reference to Microsoft.Cpp.Win32.user.props. That is useful if you need to ensure the project is entirely self-contained: that it doesn't get include paths from the environment, for example. Then you just have to specify the paths in the project itself, or in a custom property sheet that is part of the project (recommended for ease of reuse)

这篇关于编辑 $(IncludePath) “宏"在 Visual Studio 2010 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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