Take the 2-minute tour ×

My class header can't find a protocol declared in another header which is defined "outside". The structure is as follows:

x1.h has the protocol
x2.h imports x1.h
x3.h imports x2.h

The problem is, that x3.h is unable to find the protocol.

I want avoid to import x1.h in x3.h to reduce duplications

The error is "Parse Issue Expected a type"

I got a running state. But after I copied some #import from x3.m to x2.h there appears 100 errors with Unknown Type and Parse Issue. Even in arbitrary classes e.g. (y42.m) are errors. The strange thing is, that class y42.m imports x3.h and doesn't know x3.

Thanks for reading!

More Information: The x1.h content

@protocol aDelegate <NSObject>

- (void)callback;


The x2.h content

#import "x1.h"

typedef enum {

The x3.h content

#import "x2.h"

@interface x3 : NSObject <aDelegate>
    States anyState;


State is unknown and aDelegate is unknown. The reason is unknown too.

share|improve this question
Frankly, I do not really understand. You say that you do not find the protocol declaration but x1.h "has the protocol" and you believe that you could fix it by including x1.h into x2.h (which you want to avoid for good reasons). But if the protocol is in x1.h, why don't you find it? –  Hermann Klecker Mar 16 '12 at 16:53
Maybe provide compiler errors and code so we can see exactly what you're doing. –  nil Mar 16 '12 at 17:04

3 Answers 3

up vote 0 down vote accepted

I think that we need more information about the errors, but I fixed a similar problem, declaring the protocol in a separate header (and only the protocol) (x4.h), and import it in the needed classes. With the information, is the only suggestion.

share|improve this answer

You have to close x3 declaration with


And your enum is named States, not State.

Otherwise I do not see any issues with this code.

share|improve this answer

I had a similar issue, with the same error messages. Short answer: I had a circular import.

So the solution was as LuisEspinoza suggested.

Long answer: There is a .h file (a.h) that imports a whole bunch of .h files that are commonly used. It also defines a whole bunch of enums that are commonly used. I needed one of those enums in one of a.h's imported .h files (b.h). So, without thinking, I imported "a.h" inside b.h. XCode reported this as numerous instances of "Parse Issue Expected a type." I extracted the enums to c.h and import that in both a.h and b.h, which is what Luis suggested.

And the lesson learned is that when XCode reports "Parse Issue Expected a type" you should consider looking for a circular import.

share|improve this answer

Your Answer


