So I have been having this extremely frustrating problem lately with Visual C++ 2012. Up until a few hours ago, I was writing code just fine and everything was working as in
Did you copy the error messages into your question or did you retype them? Because error 14 has 'Class' with a capital C which is almost certainly not right.
Also, you should use as few include directives in your header files as possible. For example, GameScreen doesn't use PlayerEntity, so you can remove that include and BaseEntity is only used via pointer so you can replace
#include "BaseEntity.h"
with a forward declaration
class BaseEntity;
You have a circular dependency in your headers. BaseEntity.h
includes Input.h
, which includes ScreenSystem.h
, which includes GameScreen.h
, which in turn re-includes BaseEntity.h
. This leads to class names appearing before they are declared, causing compilation failure.
To avoid this, do not include headers unnecessarily. For example, do not include Input.h
from BaseEntity.h
, since it's not needed at all; and do not include BaseScreen.h
from ScreenSystem.h
since only a declaration class BaseScreen;
is needed, not the complete class definition.
Also, check that you do not have duplicate header guards. Some of them do not match the header name (e.g. GHANDLER_H
for ScreenSystem.h
), which makes me think that they may have been accidentally copied from other headers. Finally, don't use reserved names like _EntitySprite
for your own symbols; for simplicity, avoid leading or double underscores.