why we keep -D in other c Flags in xcode
Asked Answered
S

2

6

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

Solly answered 22/12, 2010 at 11:53 Comment(0)
U
8

-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.

Unvarnished answered 22/12, 2010 at 12:1 Comment(1)
@Er.Priyank Maheshwari I'm not exactly sure what you're asking.Unvarnished
K
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.

Kulda answered 1/8, 2012 at 9:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.