Preprocessor Macros ignored in XCode's project settings, but not target settings

别来无恙 提交于 2019-12-22 07:55:28

问题


When I add a Preprocessor Macro in XCode 4 to one of my targets, it is used and conditional compilation occurs as I expect it to.

However, if I move that setting to the project level and out of one of my targets the preprocessor macro apparently is ignored and not used at all.

I verified that the macro is defined at all if I put it in the project's build setting through logging that is only compiled in when that macro is enabled.

How can that be?

System: OS X Lion, XCode 4.1 build 4B110, building for iOS 4.3.5, using the LLVM compiler, not GCC.


回答1:


Have you completely deleted the build setting at the target level (not just blanked it)? If not, the target setting will completely override the project one. (You can avoid this by using $(inherited) in the target-level build setting.)

Xcode 4 makes it easy to see this type of problem: in the target’s Build Settings view, select “Levels” (instead of “Combined”) in the filter bar.



来源:https://stackoverflow.com/questions/7189450/preprocessor-macros-ignored-in-xcodes-project-settings-but-not-target-settings

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