How to define a preprocessor symbol in Xcode

前端 未结 8 1890
旧巷少年郎
旧巷少年郎 2020-11-27 10:32

Is it possible to set a symbol for conditional compilation by setting up properties in an Xcode project?

My aim is to to create a symbol that is available to all fil

8条回答
  •  青春惊慌失措
    2020-11-27 11:00

    It's under "GCC 4.2 Preprocessing" (or just put "prepro" in the search box)...

    ...however, for the life of me I can't get it to work.

    I have my standard Debug and Release configurations, and I want to define DEBUG=1 in the debugging configuration. But after adding it as a value:

    (in the settings window) > Preprocessor Macros : DEBUG=1

    #if DEBUG
        printf("DEBUG is set!");
    #endif 
    

    ...never prints/gets called. It's driving me crazy...

提交回复
热议问题