Xcode 7 and wrong file locations

I've got some moderately complicated projects where Xcode 7 has stopped providing the right line numbers, and in many cases files, for the error messages.  The log from the compiler shows the right location, but the in-line error highlights, and the links from the Command-4 error tab on the left are in entirely the wrong places. 

In some cases they show the errors on the CPP file when the errors are actually in the header.

I"ve fixed it by downgrading to 6.2 for now.  But has anyone else spotted this?  It's a tough problem to make sense of.  

(I have tried all the obvious things, deleting derived data, clean, rebuild etc. etc.)

I've seen this in Xcode for a long time, not just the latest version. Sometimes just restarting it and rebuilding sorts it out for me. It could also be caused by mixed line-endings in your source file, I've seen editors get confused by that in the past.

I'll have another play.  I have both versions installed now. 

I just can't imagine how hard it must have been for them to get it that wrong.  :)

If Xcode is screwed up, here are a few things that sometimes help:

  • "Clean Build Folder" (cmd+option+shift+K)
  • rm -rf ~/Library/Developer/Xcode/DerivedData
  • sudo rm -rf /var/folders/*
  • Reboot