I’ve been trying to debug this issue for weeks now and I have made zero progress. In one of my projects, my .mm files no longer have the proper syntax coloring except for things like @property, @synthesize and primitive types like BOOL, int, double, etc. The .cpp files are fine. I’ve tried just about every ‘fix’ I could find on the web. I’ve:
- Deleted the ‘Derived Data’ for the project under Organizer.
- Right-clicked on the project’s .xcodeproject file in Finder, selected ‘Show Package Contents’ and deleted all but the .pbxproj file.
- Product > Clean
- Messed around with the Editor > Syntax Coloring options.
- Ensured that all of my Header Search Paths were using the ‘$(SRCROOT)/’ prefix.
-
Ensured that all of the header files to be imported from these paths were imported by:
#import <header.h>
instead of:
#import "header.h"
I feel like I’m out of options. Does anyone else have a fix that is different from the things I’ve already tried hundreds of times? Not having the proper syntax coloring is driving me insane.
Thanks.
EDIT: Forgot to mention, I also looked at the log in Console.app and saw this:
12/5/11 3:08:08 PM Xcode[7623] [?T] IDEIndexingClangInvocation: Failed to save PCH file: /Users/jinser/Library/Developer/Xcode/DerivedData/ABBYY_MenuApp-ezwvcbulelfqwkftuwttlogvxsym/Index/PrecompiledHeaders/OpenCV_iPhone_Prefix-bqbegypvoktytjhgrfdzxrzeamix_ast/OpenCV_iPhone_Prefix.pch.pth
Did you ever modify your .pch file? If you have a .pch file that isn’t strictly correct, this can break the indexer. For example, if you use
#import "header.h"where you really need#import <EmbeddedFramework/header.h>, this will actually compile just fine in regular files (assuming your header search paths are set up to findheader.h) but, if present in the .pch, it will break the indexer as it’s not strictly correct.Try deleting the contents of your .pch file, then delete all DerivedData and let Xcode re-index. If things highlight correctly now, you know your .pch was the problem.