Possible Duplicate:
error: expected class-name before ‘{’ token
I've got one main super-class GameObject and derived class GuiBitMapFont. It always throws expected class-name error. But if I will add forward derivation in GuiBitMapFont class GameObject; it throws invalid use of incomplete type 'class GameObject' and forward declaration of 'class GameObject'.
EDIT Yes there was #include GuiBitMapFont in GameObject file. But that was my mistake while writing this question. Compiler still throws those two errors.
#ifndef GAMEOBJECT_H
#define GAMEOBJECT_H
#include <string>
#include "Texture.h"
class GameObject {
private:
int x;
int y;
int width;
int height;
public:
GameObject();
GameObject(int x, int y, int width, int height);
GameObject(const GameObject& orig);
virtual ~GameObject();
virtual void draw();
virtual void update();
//ignore those, i need to rewrite it....
void setX(int x);
void setY(int y);
void setWidth(int width);
void setHeight(int height);
int getX() const;
int getY() const;
int getWidth() const;
int getHeight() const;
};
#endif /* GAMEOBJECT_H */
and derived
#ifndef GUIBITMAPTEXT_H
#define GUIBITMAPTEXT_H
#include <string>
#include "SDL.h"
#include "GameObject.h"
#include "BMF.h"
class GuiBitMapText : public GameObject { //error: expected class-name before '{' token
private:
std::string text;
BMF *font;
//SDL_Surface *surf;
SDL_Texture *texture;
public:
GuiBitMapText(int x, int y, std::string text, BMF *font);
GuiBitMapText(const GuiBitMapText& orig);
virtual ~GuiBitMapText();
virtual void draw();
virtual void update();
};
#endif /* GUIBITMAPTEXT_H */