lo tolmencre
lo tolmencre

Reputation: 3934

How to specify custom compiler flags for Visual Studio Compiler

With the GCC you can use -D<custom flag> to pass for example a value to a macro that you defined in your code. But I can't find any information on how to do this for the VSC. Does anybody know?

So an example for the GCC case would like like this:

g++ -DMYFLAG=1 program.cpp

Upvotes: 3

Views: 3726

Answers (1)

user90076
user90076

Reputation: 11

But I can't find any information on how to do this for the VSC.

I find that hard to believe. https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx was the first result I got when googling "visual studio macro command line". Failing that, F1 or searching MSDN would still get you the same answer.

/D (Preprocessor Definitions)

Defines a preprocessing symbol for a source file.

Syntax

/Dname[= | # [{string | number}] ]

Upvotes: 1

Related Questions