Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How/Where are the environment variables in a Visual Studio C++ project set?

There a lots of environment variables in my project properties that I do not understand. Clicking on macros (Is there a list of Visual Studio environment variables?) gives me a list of their values, but I am unable to figure out where some of these are set. For example, I am trying to figure out where the variable $(IntDir) is being set.

What file is responsible for setting these variables? How can I modify them?

like image 446
Shailesh Tainwala Avatar asked Jan 13 '12 09:01

Shailesh Tainwala


2 Answers

These are not environment variables.

They're just macros defined by the build system that you can use for setting build properties for your project. They automatically expand to things like the target platform ($(Platform)), the path to store intermediate files for your project ($(IntDir)), and the name of your project ($(ProjectName)).

You can't change them directly, but you can change them by modifying your project's properties. The project file (created automatically by Visual Studio when you create a new project) is responsible for setting them.

You already found a link to the big list of 'em, which is helpful in explaining what they are and what they do. As the documentation says, you can use them anywhere in your project's property pages that string values are accepted. They keep you from having to hard-code paths and other information, which is exceptionally useful.

Unlike environment variables, they do not persist or have any meaning independent of your build system. Once your project has been built, they go away. They're not used during debugging or deployment.

like image 109
Cody Gray Avatar answered Nov 18 '22 00:11

Cody Gray


.If you want to see actual values for a specific VS instance for both 'standard' and 'custom', see if this answer helps. (Basically, you can use Process Explorer to find that out.)

like image 29
Nikita R. Avatar answered Nov 18 '22 01:11

Nikita R.