Hi!
I'm having this error when I go to compile:
Quote:
C:\...\Ciudadano.h|6|error: expected class-name before '{' token|
The code of
Ciudadano.h:
#ifndef CIUDADANO_H_INCLUDED
#define CIUDADANO_H_INCLUDED
#include "Entidad.h"
class Ciudadano : public Entidad {
private:
int foto, trasla;
Sprite *grafico;
public:
Ciudadano();
~Ciudadano();
void renderizar();
};
#endif // CIUDADANO_H_INCLUDED
I tried to make a
Foward Declaration, but like I suspected, it gives me error:
Quote:
C:\...\Ciudadano.h|8|error: invalid use of undefined type `struct Entidad'|
C:\...\Ciudadano.h|6|error: forward declaration of `struct Entidad'|
The code of
Ciudadano.h with Foward Declaration:
#ifndef CIUDADANO_H_INCLUDED
#define CIUDADANO_H_INCLUDED
#include "Entidad.h"
class Entidad;
class Ciudadano : public Entidad {
private:
int foto, trasla;
Sprite *grafico;
public:
Ciudadano();
~Ciudadano();
void renderizar();
};
#endif // CIUDADANO_H_INCLUDED
The header of
Entidad.h:
#ifndef ENTIDAD_H_INCLUDED
#define ENTIDAD_H_INCLUDED
#include "Universo.h"
class Entidad {
protected:
float pos_x, pos_y, size_w, size_h;
public:
Entidad();
~Entidad();
void actualizar(float planeta_x, float planeta_y, float planeta_z, float tamano_planeta, float rotacion_planeta);
float getX();
};
#endif // ENTIDAD_H_INCLUDED
I'm getting crazy trying to fix this error :(
[Edited by - pitxardo on January 20, 2010 4:01:27 AM]