Turning on 'DEBUG' macro value

前端 未结 3 1750
暗喜
暗喜 2020-12-29 00:32

In my code, I want to conditionally perform a few operations with:

#ifdef DEBUG
NSLog(@\"I\'m in debug mode\");
#endif

I\'ve configured Pro

3条回答
  •  感情败类
    2020-12-29 01:14

    You need to set a compiler flag for that.

    To do it, Get Info on the target, make sure you have selected the Debug configuration (and not All Configurations), and look for Other C Flags and Other C++ Flags (in Xcode 3.1 these are under GCC 4.2 - Language).

    Then add the following as a value: -DDEBUG for both.

    This will define the DEBUG for the precompiler to pick it up.

提交回复
热议问题