XCode的项目设置中忽略了预处理器宏,但目标设置中没有 [英] Preprocessor Macros ignored in XCode's project settings, but not target settings

查看:82
本文介绍了XCode的项目设置中忽略了预处理器宏,但目标设置中没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将XCode 4中的预处理器宏添加到我的目标之一时,将使用它并按条件进行条件编译。

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.

怎么可能?

系统:OS X Lion,XCode 4.1 build 4B110,使用LLVM编译器而不是GCC为iOS 4.3.5构建。

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

推荐答案

您是否已在目标级别完全删除了构建设置(而不仅仅是将其设置为空白)?如果不是,目标设置将完全覆盖项目之一。 (您可以通过在目标级别的构建设置中使用 $(继承)来避免这种情况。)

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可以很容易地看到这种类型的问题:在目标的构建设置视图中,在过滤器栏中选择级别(而不是组合)。

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.

这篇关于XCode的项目设置中忽略了预处理器宏,但目标设置中没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆