views:

790

answers:

3

Is there a way to add extra preprocessor #define in devenv command line?

+2  A: 

I am not entirely sure what you mean by vcbuild command line but if you mean the Visual C++ command line compiler then you can add defines by add /Dxxxx, e.g.

cl.exe /DSHAREWARE ....

Additional answer based on comments:

You should be able to set the CL environment variable with the extra preprocessor define:

SET CL=/DSHAREWARE
devenv ....

Mere information can be found at MSDN

HakonB
I had in mind devenv.exe. cl only compiles IIRC. devenv does linking as well.
Paulius Liekis
That works fine - I just found the same answer somewhere else. Thanks anyway!
Paulius Liekis
Well, then you should accept the answer so others can see that this question is solved...
HakonB
A: 

right click on the project goto C++/preprocessor preprocessor Definitions

rerun
I need to do it from a command line. I don't want to modify project settings or create extra configuration.
Paulius Liekis
A: 

The #defines are defined in your Visual Studio project file (.dsp or .vcproj file). This is a simple text file. So you could edit the project file from a script, then call devenv.exe.

user9876