2

I just used Xcode's refactoring tool to rename a core data class from Player to Person. After fixing about 100 errors resulting from using dot notation that Xcode missed in the rename, I got to the last one:

Player.m - Lexical or Preprocessor issue - 'Person.h' not found

Player.m no longer exists in the project, and shows up as deleted (empty icon) in the error. Obviously, since I got rid of it, I don't want it to exist anymore!

To fix this, I have tried re-adding an old copy of Player.h and Player.m, and also cleaning. I have checked the Build Phases->Compile Sources section, and Person.m is there, Player.m is not. Person.h does in fact exist.

Not sure if it matters, but I am using mogenerator to generate my core data classes. Also, this is my third xcdatamodel version. Versions 1 and 2 used Player.h.

Here is a screenshot of the error: Player.m - Lexical or Preprocessor issue - 'Person.h' not found

arsenius
  • 12,090
  • 7
  • 58
  • 76
  • Do you have files that are red in your file list? – Simon Germain Oct 04 '12 at 18:25
  • 1
    Try clean build, if that doesn't work restart Xcode, if that doesn't delete the `DerivedData` directory, maybe even reboot. – leo Oct 04 '12 at 18:37
  • @leo, I had tried cleaning before to no avail. But I did a clean build, quit Xcode, and deleted DerivedData, which fixed the problem. Add that as an answer and I'll give you credit for it. – arsenius Oct 05 '12 at 04:39

3 Answers3

6

Try clean build, if that doesn't work, restart Xcode, if that doesn't, delete the DerivedData directory, maybe even reboot.

Xcode sometimes gets confused.

leo
  • 7,518
  • 1
  • 24
  • 25
2

You can try to do a super clean (not sure what the real term is) by hitting Cmd+Alt+Shift+K. This performs a clean and removes everything from the build folder.

Simon Germain
  • 6,834
  • 1
  • 27
  • 42
  • Since the issue is gone now I can't test whether this would have fixed my problem (looks like it might have). But I never knew about that option. Thank you! – arsenius Oct 05 '12 at 13:37
  • It saved my behind quite a few times in the past. It's a good trick to know :) – Simon Germain Oct 05 '12 at 13:38
  • It's actually called **Clean build folder** (also available in the Product menu with Option key pressed) - but I like *Super Clean* more ;-) – Jay Oct 08 '12 at 15:20
0

Well I had a very similar problem and solve it removing the missing compile source of my project settings. to do that follow these steps

  1. Click at the project page. This page contains the general settings of your app
  2. Select Build phases.
  3. In Build Phases section, select compile sources.
  4. If there is missing some class or file or something that needs to be compiled.
  5. Select water mark file and click the minus sign at the bottom of this section.

Just click and the project may run. I hope this help others.

AXSM
  • 1,142
  • 1
  • 12
  • 27