eaglesky
eaglesky

Reputation: 720

How to set relative include path in Visual Studio 2010?

I wrote a library called MyLib with some Visual Studio projects in MyLib\Samples\, and the include files reside in MyLib\inc. In order to make these include files accessible in the projects, I need to add their path in the project properties.

I want to use a relative path, so that I don't need to change the properties each time I move the whole library folder to other places. But what does the relative path look like? For example, one of the project path is: ...\MyLib\Samples\proj1, how do I represent the ...\MyLib\inc relative to the project path?

Upvotes: 3

Views: 9544

Answers (2)

rustyx
rustyx

Reputation: 85256

What you're looking for is custom properties for your project.

Visual Studio has support for defining custom properties which you can subsequently use in macro expansions in your include path, for example.

Here's an example of how it looks like: enter image description here

Upvotes: 1

James McNellis
James McNellis

Reputation: 354969

Use the $(SolutionDir) or $(ProjectDir) MSBuild properties to root the paths. These are replaced at build-time with the directory in which the Solution and Project are located, respectively.

Upvotes: 9

Related Questions