tags:

views:

136

answers:

2

I'm compiling my iPhone app, and I'm getting the following error in the header of MPMediaItem from the MediaPlayer.framework:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks/MediaPlayer.framework/Headers/MPMediaItem.h:14: error: expected '=', ',', ';', 'asm' or 'attribute' before 'class'

How can I fix that? Thanks:

A: 

My first guess is you used #include rather than #import. Or somehow the compiler is trying to parse it as a standard C file.

Mike Weller
It's using #import. Like I said the error is from the header of the MediaPlayer.framework, which I can only read from. Hence, even If I wanted I couldn't change the #import statement to #include. Why would the compiler parse it as a standard C file?
mobilekid
+1  A: 

I've just solved this exact same problem and I have been tearing my hair out over it.

GCC wasn't highlighting the problem in the header file where the error actually occurred - I had a stray 'B' character at the bottom of a header file (from running command-B to compile). The error was then being thrown in the .m file and other .h files which included the problematic one, often at the @class statement.

If it's throwing an issue with your @class statement, the problem is almost definitely in one of the preceding header files, as you include them directly beforehand - try commenting these out one-by-one and recompiling to find out which. Once you find the culprit file, finding the actual error will be much easier.

Rónán Ó Braonáin