error LNK2001: unresolved external symbol

Posted by numerical25 on Stack Overflow See other posts from Stack Overflow or by numerical25
Published on 2010-06-16T02:42:23Z Indexed on 2010/06/16 2:52 UTC
Read the original article Hit count: 308

I am receiving this error

>GXRenderManager.obj : error LNK2001: unresolved external symbol "private: static class GXRenderer * GXRenderManager::renderDevice" (?renderDevice@GXRenderManager@@0PAVGXRenderer@@A)

The following is my code...

GXDX.h

class GXDX: public GXRenderer {
public:
    void Render();
    void StartUp();
};

GXGL.h

class GXGL: public GXRenderer {
public:
    void Render();
    void StartUp();
};

GXRenderer

class GXRenderer {
public:
    virtual void Render() = 0;
    virtual void StartUp() = 0;

};

GXRenderManager.h

#ifndef GXRM
#define GXRM
#include <windows.h>
#include "GXRenderer.h"
#include "GXDX.h"
#include "GXGL.h"

enum GXDEVICE {
    DIRECTX,
    OPENGL
};

class GXRenderManager {
public:
    static int Ignite(GXDEVICE);

private:
    static GXRenderer *renderDevice;

};

#endif

GXRenderManager.cpp

#include "GXRenderManager.h"

    int GXRenderManager::Ignite(GXDEVICE DeviceType)
    {
        switch(DeviceType)
        {
        case DIRECTX:
            GXRenderManager::renderDevice = new GXDX;
            return 1;
            break;
        case OPENGL:
            GXRenderManager::renderDevice = new GXGL;
            return 1;
            break;
        default:
            return 0;
        }
    }

main.cpp

#include "GXRenderManager.h"

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    return 0;
}

I am not trying to get it to do anything. I am just trying to compile with no errors. I am new with all this so if anyone can give me a hand. that will be great. thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about c