Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xCode 4.4 does not get all the .pch file headers imports?

This is my .pch file -

   // // Prefix header for all source files of the 'English Club' target in the 'English Club' project //  #import <Availability.h>  #ifndef __IPHONE_4_0 #warning "This project uses features only available in iOS SDK 4.0 and later." #endif  #ifdef __OBJC__     #import <UIKit/UIKit.h>     #import <Foundation/Foundation.h>     #import <CoreData/CoreData.h>     #import "Helper.h"     #import "Animations.h"     #import "Constants.h"     #import "SoundPlayer.h"     #import "UAirship.h"     #import "UAStoreFront.h"     #import "UIIMagesNames.h"     #import "UIView+Sizes.h"     #import "HelpButton.h"     #import "SoundPlayer.h"     #import <RestKit/RestKit.h>     #import "UIHelpSoundFiles.h"   #endif 

Still it is very frequent that Xcode will give me errors that he can not find those classes. (Helper for example). The thing is that the project will be compiled and work fine but I have hundreds of errors that disturb me looking for the real ones.

Any idea why?

like image 454
shannoga Avatar asked Aug 07 '12 06:08

shannoga


People also ask

What is .PCH file in Xcode?

A . pch is a Pre-Compiled Header. In the C and C++ programming languages, a header file is a file whose text may be automatically included in another source file by the C preprocessor, usually specified by the use of compiler directives in the source file.

How do I open a header file in Xcode?

Holding the Command key, click the import/include statement to view the header. Also, you can Command-click on a symbol to jump to the header file that defines it.


2 Answers

This appears to be a known issue in Xcode 4.4 (as seen in the release notes)

It is suggested to Delete the PCH index folder to workaround this issue.

To locate this folder, in Xcode, open the Organizer and select the Projects tab, then select the project in the left-hand pane. You should see the Derived Data path for this particular project with a small arrow to Show in Finder. If you click on this arrow, you will be taken to the right location in Finder. If you then navigate to the Index subfolder and delete PrecompiledHeaders folder, you should be all set.

Xcode should re-index, and re-create this folder, but the errors should be gone.

like image 172
Jean-Philippe Couture Avatar answered Sep 19 '22 08:09

Jean-Philippe Couture


I found that just updating your pch file (add and delete space) and rebuild will cause xcode to fix those problems

like image 35
Yariv Nissim Avatar answered Sep 22 '22 08:09

Yariv Nissim