David Maymudes
David Maymudes

Reputation: 5654

Something changed, now 5800 compiler errors from precompiled header

I apparently changed something in an iPhone Xcode project, and now when it precompiles the headers I'm getting

In file included from [...] /Foundation.framework/Headers/Foundation.h:8,
                 from [...] /UIKit.framework/Headers/UIAccelerometer.h:8,
                 from [...] /UIKit.framework/Headers/UIKit.h:9:
/Developer/Platforms/[...]/NSObjCRuntime.h:146: error: stray '@' in program
/Developer/Platforms/[...]/NSObjCRuntime.h:146: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'NSString'

and then 5800 more errors...

I'm hoping somebody else did this to themselves recently and can point me in the right direction!

Upvotes: 0

Views: 1811

Answers (4)

max
max

Reputation: 103

Click every file(e.g .c files) you have in the Xcode navigator. On the right panel, open the Identity and Type view and set the File Type to Objective-C source, this works for me.enter image description here

Upvotes: 1

Mischa22
Mischa22

Reputation: 33

Just remove .something long../UIKit.h reference from you project settings for "Prefix Header", replace it with something from your previous projects.

Upvotes: 0

SLaks
SLaks

Reputation: 887225

As cdespinosa linked, you're compiling Objective-C as regular C++.

Go into the project settings and change the "Compile Sources As" to Objective-C++

Upvotes: 1

Related Questions