Error C2504 - Base class undefined

I know this is not the best way to deal with that problem, but it work for me at least. you can put all your other includes in the cpp file:

#include "OmiGame/OmiGame.h"
#include "PlayState.h"
#include "Mob.h"
#include "resources.h"

Forward declaring doesn't help for class Player : public Mob because the compiler needs the full definition for inheritance.

So most likely one of your includes in Mob.h is bringing in Player.h which then puts Player ahead of Mob and thus triggers the error.


I have got through the similar problem and I out solution and made it a thumb rule for me

Solution / Thumb Rule

//File - Foo.h
#include "Child.h"
class Foo 
{
//Do nothing 
};

//File - Parent.h
#include "Child.h" // wrong
#include "Foo.h"   // wrong because this indirectly 
                   //contain "Child.h" (That is what is your condition)
class Parent 
{
//Do nothing 
Child ChildObj ;   //one piece of advice try avoiding the object of child in parent 
                   //and if you want to do then there are diff way to achieve it   
};

//File - Child.h
#include "Parent.h"
class Child::public Parent 
{
//Do nothing 
};

Don't include the child in parent class .

if you want to know the way to have a child object in a parent class the refer the link Alternative

Thank you