views:

233

answers:

3

It is my GameEngine.h:

#import <Foundation/Foundation.h>
#import "GameArray.h";


@interface GameEngine : NSObject {
    GameArray *gameButtonsArray;
}

@property (nonatomic, retain) GameArray *gameButtonsArray;

And this is my GameArray.h:

#import <Foundation/Foundation.h>
#import "MyAppDelegate.h";

@interface GameArray : NSObject {
    NSMutableArray *gameButtonsArray;

}
@property (nonatomic, retain) NSMutableArray *gameButtonsArray;

It keep prompt my "expected specifier-qualifier-list" error i my GameEngine.h, and error said that "expected specifier-qualifier-list before 'GameArray'", what's going on?

+2  A: 

Lose the semi-colon on line 2 in your .h file

Paul Lynch
just added , still got the problems.
Tattat
I see that you have edited the question and ADDED semi-colons on line 2 of both .h files. You need to REMOVE them.
Paul Lynch
A: 

If removing the unnecessary semicolons does not fix your problem, most likely MyAppDelegate.h imports GameEngine.h creating a circular dependency between the GameEngine.h and GameArray.h. Try removing the #import "GameArray.h" from GameEngine.h and replacing it with:

@class GameArray;

Also add

#import "GameArray.h"

to GameEngine.m below the import of GameEngine.h

JeremyP
+1  A: 

This is the best practice.

GameEngine.h

#import <Foundation/Foundation.h>

@class GameArray;

@interface GameEngine : NSObject {
    GameArray *gameButtonsArray;
}

@property (nonatomic, retain) GameArray *gameButtonsArray;

Then in GameEngine.m

#import "GameEngine.h"
#import "GameArray.h"

@implementation GameEngine    
//...
@end

This prevents circular references wherein one header imports a second header which imports the first which imports the second and so on in an endless cycle.

TechZen