I have a very simple bit of code. I suspect that most part of it is unrelated, but as I’m completely puzzled about this problem, I decided to include the source as is.
GQEncounter.h:
#import <Foundation/Foundation.h>
#import "GQEncounterViewController.h"
@interface GQEncounter : NSObject {
NSArray *roughOptions;
NSString *roughText;
}
@property (readonly) NSArray *options;
@property (readonly) NSString *text;
- (id) initFromDictionary:(NSDictionary *) dict;
- (void) executeOption:(NSInteger) number;
@end
GQEncounterViewController.h:
#import <UIKit/UIKit.h>
#import "GQEncounter.h"
@interface GQEncounterViewController : UIViewController {
GQEncounter *_encounter;
UILabel *encounterText;
NSArray *encounterButtons;
CGRect _rect;
}
- (id)initWithEncounter:(GQEncounter *)encounter
rect:(CGRect)rect;
- (void)chooseOption:(UIButton *)button;
@end
As you can see, it’s really simple. But, for some unknown reason, xcode shows errors in GQEncounterViewController file: “Unknown type name ‘GQEncounter'” at declaration of _encounter variable, and “Expected a type” at initWithEncounter declaration. It is as if GQEncounter isn’t included in the file at all. I use xcode 4.4.1. I even re-installed it trying to get rid of this problem, but it didn’t help.
What is happenning here?
I’m not sure why you have
GQEncounterViewControllerimport statement in theGQEncounter.hfile but try to move it out and if you really need it, use@class GQEncounterViewController;instead