Código:
GameScreenC:\Users\Héctor\Documents\Visual Studio 2010\Projects\GekkoEngine\src\Components\../../include/Cube.hpp:12: error: invalid use of incomplete type 'struct Component' C:\Users\Héctor\Documents\Visual Studio 2010\Projects\GekkoEngine\src\Components\../../include/GameScreen.hpp:14: error: forward declaration of 'struct Component'
Código:
Cube#ifndef GAMESCREEN_H #define GAMESCREEN_H #include <string> #include <list> #include <iostream> #include <functional> #include <algorithm> #include "Util.hpp" #include "object.hpp" #include "Component.hpp" class Engine; class Component; // Line 14 class GameScreen : public object { public: GameScreen(std::string); void setEngine(Engine *engine); Engine* getEngine(void); void setName(std::string); string getName(void); void AddComponent(Component*); void RemoveComponent(Component*); void PutComponentInOrder(Component*); void LoadGameScreen(void); virtual void Draw(void); virtual void Update(void); // Sobrescribimos el operador == para poder hacer nuestra propia comparacion // friend: no pertenece a la clase, pero puede usar sus miembros friend bool operator == (const GameScreen &gs1, const GameScreen &gs2); GameScreen& operator = (const GameScreen &gs); protected: virtual void Load(void); private: string name; static Engine* engine; std::list<Component*> components; bool loaded; }; struct CompareGS : public std::binary_function < GameScreen*, GameScreen*, bool> { bool operator() (const GameScreen* gs1, const GameScreen* value) const { return (gs1 == value); } }; #endif // GAMESCREEN_H
Código:
#ifndef CUBE_H #define CUBE_H #include "../glm/gtc/matrix_transform.hpp" #include "../glm/gtc/type_ptr.hpp" #include "../include/GraphicsUtil.hpp" #include "Component.hpp" #include "GameScreen.hpp" class Cube : public Component { // Line 12 public: Cube(); void Update(void); void Draw(void); protected: void Initialize(void); void Load(void); private: static Mesh* mesh; static Shader* shader; static GLuint ShaderIds[3], TextureId; static GLuint ModelMatrixUniformLocation, Tex0Loc; static mat4 ModelMatrix; }; #endif // CUBE_H