简体   繁体   中英

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

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}] ]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM