开发者

Edit $(IncludePath) "macro" in Visual Studio 2010

Visual Studio 2010 ("Project Properties" dialog)

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.

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

or is $(IncludePath) specific to this project and only the result of the "Inherit from parent or project defaults" checkbox? (in which开发者_高级运维 case the question turns into: How do I edit project defaults for that since it appears to be depreciated in Visual Studio options)

Thanks!

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)


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.

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

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).

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)


  1. VC++ Directories in VS2010 are project-specific. There are no global settings like in VS2008.
  2. There is INCLUDE environment variable which corresponds to $(IncludePath), so check it first.
  3. Formerly VS saved all global settings in Documents and Settings\\Local Settings\Application Data\Microsoft\VisualStudio\\VCComponents.dat so try to delete such file if it is present for all VS versions. I don't have such file for VS2010, but it's worth checking in your case.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜