How to add custom variable to c++ project

P

Pavel A.

There are many predefined variables in a VC++ project properties
like $(DevEnvDir), $(TargetName) etc.
I'd like to add my custom variable to the project or solution (to share
among several projects).

Example: path or parameters of a custom libraries, sources or tools.

Is this possible? How?

Defining global environment variables is not a good solution, because
I want these variables be *local in a project*.

Regards,
--PA
 
P

PvdG42

Pavel A. said:
There are many predefined variables in a VC++ project properties
like $(DevEnvDir), $(TargetName) etc.
I'd like to add my custom variable to the project or solution (to share
among several projects).

Example: path or parameters of a custom libraries, sources or tools.

Is this possible? How?

Defining global environment variables is not a good solution, because
I want these variables be *local in a project*.

Regards,
--PA
Write a small class and declare your variables as public static, then add
the class to any project where you want the variable?
 
B

Ben Voigt [C++ MVP]

Pavel said:
There are many predefined variables in a VC++ project properties
like $(DevEnvDir), $(TargetName) etc.
I'd like to add my custom variable to the project or solution (to
share among several projects).

Example: path or parameters of a custom libraries, sources or tools.

Is this possible? How?

Defining global environment variables is not a good solution, because
I want these variables be *local in a project*.

Environment variables are per-process, the trick is getting them
automatically set in Visual Studio.

I've used
http://www.workspacewhiz.com/OtherAddins.html#SolutionBuildEnvironment for
that purpose.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top