I'm making a Cocos2d game for iphone, and I have my main game mode, Game
, which inherits from CCLayer
.
I'm trying to make another game mode, MathGame
, which inherits from Game
, but when I try to compile, I get this error in MathGame.h
:
Attempting to use the forward class 'Game' as superclass of 'MathGame'
I get the error even if the implementation and interface of MathGame
are empty. And it only happens if I try to include MathGame.h
in another file.
Here's the code for the Game class:
// Game.h
#import "cocos2d.h"
#import <GameKit/GameKit.h>
#import "SplashScreenLayer.h"
@interface Game : CCLayer
// A bunch of stuff
@end
The new game type:
// MathGame.h
#import "Game.h"
@interface MathGame : Game
@end
And the main menu that includes both:
// SplashScreen.h
#import "cocos2d.h"
#import "Game.h"
#import "MathGame.h"
#import "HowToPlayLayer.h"
#import "AboutLayer.h"
@interface SplashScreenLayer : CCLayer
// A bunch of stuff
@end
I can't find anything helpful online. Any ideas?