I've been looking at this error for a while and I can´t see where it fails. These are the errors I get:
1 2
C:\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'
BTW, I think Peter87 meant to ask if the class declaration for Component was in component.hpp. If the declaration for Component is in component.cpp, that's your problem. You can't inherit an incomplete (forwarded) class.
BTW, I think Peter87 meant to ask if the class declaration for Component was in component.hpp.
No I mean class definition. What he has in Component.hpp is the class definition.
@ShotoReapre
You have a circular dependency. Component.hpp and GameScreen.hpp both include each other. They shouldn't have to include each other. The forward delectations should be all they need. I don't think it will cause an error but maybe you have other circular dependencies that cause this error you are having.
The problem is I need this circular dependencie: Component class have a GameScreen variable ' Parent' and GameScreen class have a std::list<Components>
In your code it is std::list<Component*>. It is just pointers so a forward declaration of Component is all that's needed. Include component.hpp in GameScreen.cpp instead.
I followed the advice of the link, but now I get this error:
1 2
C:\Users\Héctor\Documents\Visual Studio 2010\Projects\GekkoEngine\src\Components\Component.cpp:29: error: invalid use of incomplete type 'struct GameScreen'
C:\Users\Héctor\Documents\Visual Studio 2010\Projects\GekkoEngine\src\Components\../../include/Component.hpp:12: error: forward declaration of 'struct GameScreen'
As engine is a pointer I add the forward declaration 'class Engine;' above 'class GameScreen;' in Component.hpp but it doesn´t works and give me the same error