Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unexpected '@' in program (Xcode)

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.

like image 385
olynoise Avatar asked Nov 19 '11 23:11

olynoise


2 Answers

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.

like image 56
Aaron Douglas Avatar answered Nov 15 '22 23:11

Aaron Douglas


You are including the header from a file that is not compiled as Objective C.

like image 27
Skyler Saleh Avatar answered Nov 15 '22 23:11

Skyler Saleh