Error 2061 - Class Becomes "Undefined" When I Include A Header
<p>This is very strange and I can't get my head around what is causing it.... So I have two classes, Player and Enemy and a utility static class CollisionMgr.</p>

<p>I have an array of Enemies in the world class, I'd like to have a pointer to it in the Player class for collision detection. But the moment i try to #include the Enemy class in the player one, I get "Player undefined" error in the Enemy one.... I think it has to do with the header inclusions...</p>

<pre><code>    #pragma once
    #include &lt;string&gt;
    #include &lt;vector&gt;

    #include "mathlib.h"
    #include "md2model.h"
    #include "Object3DS.h"



    const float PLAYER_FORWARD_SPEED = 60.0f;
    const float PLAYER_HEADING_SPEED = 60.0f;

    class Player : public GameObject
    {
    public:

        Player(float r);
        ~Player();

        void loadModel(const char *filename);
        void drawModel();
        void drawBoundingWireframe();
        void passVisibleObjects(vector&lt;Object3DS*&gt; &amp;vo);

    private:
    Entity3D entity;
MD2Model* player;

float modelRot;
float modelPitch;

Vector3 scale;
Vector3 pos;
Vector3 rot;

float forwardSpeed;
float heading;

float radius;


vector&lt;Object3DS*&gt; visibleObjects;

    };
</code></pre>

<p>And this is the Enemy class</p>

<pre><code>    #pragma once
    #include &lt;string&gt;
    #include &lt;vector&gt;

    #include "Player.h"
    #include "mathlib.h"
    #include "md2model.h"


    const float ENEMY_FORWARD_SPEED = 60.0f;
    const float ENEMY_HEADING_SPEED = 60.0f;

    class Enemy : public GameObject
    {
    public:

Enemy(Player* p, float r);
~Enemy();

void loadModel(const char *filename);
void drawModel();
void drawBoundingWireframe();


bool checkCollision();

void setPosition(Vector3 pos);
void setRotation(Vector3 r);
void setScale(Vector3 r);


void setSpeed(float s);
void setHeading(float h);
float getForwardSpeed();
float getHeading();
void rotateModel(float dx, float dy);
void resetRotation();

void setAnimation(char *filename);

Vector3 getPosition();
void moveEnemy(float elapsedTimeSec);

Entity3D entity;

void passVisibleObjects(vector&lt;Object3DS*&gt; &amp;vo);



    private:
MD2Model* enemy;

Player* player;

float modelRot;
float modelPitch;

Vector3 scale;
Vector3 pos;
Vector3 rot;

float forwardSpeed;
float heading;

float radius;

vector&lt;Object3DS*&gt; visibleObjects;

    };
</code></pre>

<p>In the source files i include this static class with some collision functions:</p>

<pre><code>    #pragma once


    #include &lt;vector&gt;
    #include "mathlib.h"
    #include "Object3DS.h"

    #include "Enemy.h"

    class CollisionMgr{


    public:

static vector&lt;Object3DS*&gt; findVisibleObjects(BoundingBox &amp;viewingVolume,                 vector&lt;Object3DS&gt; &amp;gameObjects, vector&lt;Object3DS*&gt; &amp;visibleObjects);
static vector&lt;Enemy*&gt; findVisibleEnemies(BoundingBox &amp;viewingVolume, vector&lt;Enemy&gt; &amp;enemies, vector&lt;Enemy*&gt; &amp;visibleEnemies);
static bool checkCollision(const Vector3 pos, const Vector3 forward, float radius, const vector&lt;Object3DS*&gt; &amp;vo);
static double intersectRaySphere(Vector3 rO, Vector3 rV, Vector3 sO, double sR);


    };
</code></pre>

<p>All of these compile ok like this, but the moment I try to add #include "Enemy" in Player I get  error C2061: syntax error : identifier 'Player' inside the Enemy class....or if I include successfully Enemy and then try to include CollisionMgr.... there's some kind of conflict between them two and the definition of Player but I cant understand how to resolve it....</p>

<p>Am using VS2010 as my compiler..</p>

<p>Any help would be appreciated!</p>

<p>I tried re arranging the include statements but I really don't get what is causing this?</p>
