【问题标题】:Prefix.pch not included at compilation time编译时不包含 Prefix.pch
【发布时间】:2011-11-28 12:10:47
【问题描述】:

我在 GlobalVar.h 和其他 .h 文件中定义了许多常量。我将这些文件导入到 Prefix.pch 文件中,如下所示:

//
// Prefix header for all source files of the 'XXX' target in the 'XXX' project
//

#import "GlobalVar.h"
[...]

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <CoreData/CoreData.h>
#endif

但是当我编译项目时,所有#defined 标识符都丢失了,并报告为“使用未声明的标识符 XXX”。

我在 Build settings 中搜索,PCH 文件设置为“Prefix Header”...我在 Base SDK 4.3 和 XCode 4.0.2 上

你有调试这个的提示吗?

感谢您的帮助

【问题讨论】:

    标签: ios compilation preprocessor


    【解决方案1】:

    我遇到了这个错误,在清理 DerivedData 并重新启动 Xcode 后我修复了它。希望有所帮助。

    【讨论】:

      【解决方案2】:

      将您的导入移动到喜欢的位置

      #ifdef __OBJC__
         #import <UIKit/UIKit.h>
         #import <Foundation/Foundation.h>
         #import <CoreData/CoreData.h>
         #import "GlobalVar.h"
      #endif
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-16
        • 1970-01-01
        • 2018-08-10
        • 2010-09-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多