Search code examples
visual-studio-2010visual-studiovisual-c++msbuildinclude-path

Generalize Include Path


I am using Microsoft Visual Studios 2010, and I have found out how to set new include paths. Now I want to make it so that other users can utilize my project. If my current path is C:\Users\jsestrad\Documents\Homework\EE350\Lab\power, for example, is there a way I can start making it search from ..\Homework\EE350\Lab\power so that other users can utilize the include path?


Solution

  • You can use MSBuild properties in the path, including $(ProjectDir), which is the directory in which the project is located, and $(SolutionDir), which is the directory in which the solution is located.

    The simplest thing to do would be to ensure that everyone has the include files in the same location relative to the project, then set the include path relative to $(ProjectDir).

    For example, if your project is in C:\Users\jsestrad\Documents\Homework\EE350\Lab and your includes are in C:\Users\jsestrad\Documents\Homework\Stuff, you could add $(ProjectDir)..\Stuff to your include path.