How to define a preprocessor symbol in Xcode

前端 未结 8 1888
旧巷少年郎
旧巷少年郎 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:07

    Go to your Target or Project settings, click the Gear icon at the bottom left, and select "Add User-Defined Setting". The new setting name should be GCC_PREPROCESSOR_DEFINITIONS, and you can type your definitions in the right-hand field.

    Per Steph's comments, the full syntax is:

    constant_1=VALUE constant_2=VALUE
    

    Note that you don't need the '='s if you just want to #define a symbol, rather than giving it a value (for #ifdef statements)

提交回复
热议问题