Xcode: Setting GCC_PREPROCESSOR_DEFINITIONS for different build configurations?

血红的双手。 提交于 2019-12-09 08:41:11

问题


I want to set GCC_PREPROCESSOR_DEFINITIONS for each of my four build configurations (Debug, Release, Ad Hoc, and Distribution.) I'd like to have a different setting for each.

The screen I'm looking at is the Target Info window's "Build" tab. When I set the Configuration pop-up to "Debug" I can see my GCC_PREPROCESSOR_DEFINITIONS setting there. When I switch to "Release," or any of the other configurations, it's no longer visible. Yet when I try to add it to those configurations, it says GCC_PREPROCESSOR_DEFINITIONS already exists, and that I can't add it again.

As I said, I want to have a different setting for my various builds. How can I accomplish this?

Thanks very much.


回答1:


Make sure there isn't a setting called "Preprocessor Macros". This is the same as GCC_PREPROCESSOR_DEFINITIONS.




回答2:


OTHER_CFLAGS if I understood the question right. And pass your defines like -DDEBUG or something.

And yes, if you need to assign a value to a macro, you could do something like this - '-DSOME_MESSAGE=@"Hello, World!"'. Note ' symbols around - they are required. SOME_MESSAGE macro will be defined with @"Hello, World!" value.



来源:https://stackoverflow.com/questions/1540322/xcode-setting-gcc-preprocessor-definitions-for-different-build-configurations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!