编译时未包含Prefix.pch

时间:2011-09-30 13:48:54

标签: ios compilation preprocessor

我在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设置中搜索,PCH文件设置为“Prefix Header”...我在Base SDK 4.3和XCode 4.0.2上

您是否有提示进行调试?

感谢您的帮助

2 个答案:

答案 0 :(得分:1)

我在清除DerivedData并重启Xcode后修复了这个错误。希望能提供帮助。

答案 1 :(得分:0)

将您的导入移至类似

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