unexpected '@' in program (Xcode)

olynoise picture olynoise · Nov 20, 2011 · Viewed 20.9k times · Source

All of the sudden Xcode is giving me an error "unexpected '@' in program" at the beginning of my object @interface.

This is happening in a bunch of my objects that were previously working...

Here's an example (with errors in comments)

#import <UIKit/UIKit.h>
#import "ONCOChordDiamond.h"
@interface ONCOChordView : UIView   //// unexpected '@'  in program
{
    NSMutableArray* chordDiamonds;    
    NSUInteger      diamondWidth, diamondHeight;
}

@end                                /////unexpected '@' in program'

So why is Xcode giving me this error? It seems like a bug.

Answer

Aaron Douglas picture Aaron Douglas · Mar 22, 2012

I doubt you're still having the issue, but if you are check the header file. I pasted in code from the web in a class and the quotation marks weren't the standard " ". The marks were stylized with an opening quote and a closing quote because it came from a webpage. Retyping the quote marks fixed it.