1 out of 3 rated this helpful Rate this topic

How to: Set Environment Variables for Projects

Use the Environment or Merge Environment project settings, which are available from the <Projectname> Property Pages dialog box, to set up environment variables for projects. For more information, see Project Settings for a C++ Debug Configuration.

To set environment variables for a project

  1. Open the <Projectname> Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties node.

  3. Click the Debugging node to open the debugging property page.

  4. Modify the Environment or Merge Environment project settings.

  5. Click OK to accept any modified project settings and close the <Projectname> Property Pages dialog box.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
new variable is not used in the project Properties
Hi, I set a new environnment MY_API=$(ProjectDir)..\LIB\"
, but I can't use it to set the working directory $(MY_API)\Bin, or the include directories.
new variable is not used in the project Properties
Hi, I set a new environnment MY_API=$(ProjectDir)..\LIB\"
, but I can't use it to set the working directory $(MY_API)\Bin, or the include directories.
White Space Is Not Ignored
Also note that there should be no spaces around the equals sign:
use
NAME=VALUE
not
NAME = VALUE
Syntax

Syntax is NAME=VALUE.  Thus, to prepend "C:\Program Files\CrankCase\DLLS" to the PATH:

  • PATH=C:\Program Files\Crankcase\DLLS;%PATH% 

Macros such as $(OutDir) and $(TargetDir) may also be used--see "Macros for Build Commands and Properties" for others.

Naturally, syntax errors fail silently--intended environment modifications after the syntax error have no effect.

Advertisement