Red Nightingale
Red Nightingale

Reputation: 689

XCode insanity: Trying to compile a file that isn't referenced and doesn't exist

I'm fairly close to going on a murderous rampage about this so if someone can help me out it may save some lives...

I've got a fairly complex CoreData model which has always had an entity called Anchor. I recently decided that a couple of attributes weren't needed so I deleted them from the model and then generated new NSManagedObject files over the top of the old ones. Then all hell broke loose.

The initial compile error was for a duplicate definition of Anchor which puzzled me no end. I've had that error before and it was because I accidently included a .m file so I scoured my project for any reference to Anchor.m. Nothing.

I tried deleting the Anchor.h and .m files so I could see what was going on but instead of getting a bunch of compile errors "couldn't find Anchor.h" it compiled fine up until linking and then complained that it couldn't find Anchor.m. I did a clean and then rebuilt and still got the same error. Reset the Mac. Same error.

I've now renamed the entity in the model and regenerated a new set of files for that. I've replaced all references to the header file and changed all the class references. It's still looking for Anchor.m. I've searched the entire Mac and renamed any copies of Anchor.h and Anchor.m that I found. I've yelled very loudly at the Mac... I'm starting to lose my sanity over this...

Somewhere, somehow, the compiler has it in it's head that it needs to compile files that simply don't exist. I've scoured the xcode .xcodeproj file and removed any references to anchor. Please, please, please someone tell me where this damn file reference is so I can annihalate it and go back to getting this project finished...

Upvotes: 3

Views: 1191

Answers (1)

Nick Forge
Nick Forge

Reputation: 21464

Assuming you have removed every reference to Anchor.h/.m in your project.pbxproj file, one other thing to try is to nuke your DerivedData folder. It can be in a few different spots depending on how you have Xcode 4 setup (I have mine at ~/Builds/Xcode4/DerivedData), but that folder stores a bunch of intermediate/cache files related to your projects, and on rare occasions, it will become corrupted, causing projects to build incorrectly, or breaking code completion.

Upvotes: 5

Related Questions