kheraud
kheraud

Reputation: 5288

Prefix.pch not included at compilation time

I have defined many constants in GlobalVar.h and other .h files. I import these files in the Prefix.pch file like this :

//
// 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

But when I compile the project all the #defined identifiers are missing and reported as "Use of undeclared identifier XXX".

I searched in the Build settings and the PCH file is set as "Prefix Header"... I am on Base SDK 4.3 and XCode 4.0.2

Do you have hints to debug this ?

Thanks for your help

Upvotes: 1

Views: 2230

Answers (2)

J3RM
J3RM

Reputation: 1722

move your import to like so

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

Upvotes: 0

fannheyward
fannheyward

Reputation: 19277

I came across this error yet, after cleaning DerivedData and restart Xcode I fix it. Hope to help.

Upvotes: 1

Related Questions