getting file not found error in ios

Nik picture Nik · Mar 21, 2012 · Viewed 7.9k times · Source

Hi I am new to iOS development. Here is my problem.

I am given a mac machine with 10.6.X and Xcode for the same. I am given a pre-written project for iPhone. I wanted to run the project on my iPhone so I had to upgrade my mac and Xcode to 10.7.x and the xcode for the same. I had to do this as my iPhone was running on iOS 5.1. So my problem is that before upgrading the project was getting compiled and running properly on simulator but now after upgrade I am getting the following error

 /usr/include/objc/objc-class.h file not found

I googled a lot, but all the search if pointing to the same link as given in this link

This link did not work for me as when I try to change the import statement it leads to more 5 to 6 errors.

Answer

Greg picture Greg · Mar 21, 2012

Not sure if that will help, but sometimes XCode messes up the cached data when changing the imported .h files. Try to delete the project derived information, e.g. organizer->projects->Derived Data. Then clean the project and rebuild.

Also, the solution that you reference is system specific, which may explain why it doesn't work for you. In particular:

#import </usr/include/objc/objc-class.h>

Notice the /usr/ at the beginning of the import. This means that the file will be loaded from an absolute path starting from the root folder /, which may be different on Mac or various flavors of Linux. Try to find where exactly the file objc-class.h is located in your system and either add that path to the Header Search Path (XCode Targets -> Build Settings, section Search Paths) or add the import with location specific for your system.