why we use -D in other c flag . in target right click go in get info in build setting other c flags why we we have to write -D like -DDEBUG
-D
is the gcc flag for setting a #define
. You can also do things like -DTWO=2
, which has the same effect as #define TWO 2
.
I know this is an old question and you may already of figured it out, but here is the reason for the flag.
As robert said in his question, the -D
flag is used to #define a value. The reason it is being used as -DDEBUG
is some developers use separate header files for debug versions that contain test values for the app/program they are working on. They use #ifdef DEBUG
statement to see if DEBUG
has been defined to determine if they are writing debug header declarations or macros.
Xcode includes this for you as a way to easily seperate what values are for debug and and what values are for actual use.
Also you can use #ifndef DEBUG
to create header values or macros that you want used in the release version of your apps if there is declarations in the debug headers that also need to be set when not in debug.
© 2022 - 2024 — McMap. All rights reserved.