I\'m trying to use a static variable in my code when trying to use textures, however I keep getting this error:
1>Platform.obj : error LNK2001: unresolved ext
Static member must be defined outside class body, so you have to add the definition and provide initializer there:
class Platform :
public Object
{
public:
Platform(void);
~Platform(void);
Platform(GLfloat xCoordIn, GLfloat yCoordIn, GLfloat widthIn);
void draw();
static int loadTexture();
private:
static GLuint tex_plat;
};
// in your source file
GLuint Platform::tex_plat=0; //initialization
It is also possible to initialize it inside your class but:
To use that in-class initialization syntax, the constant must be a static const of integral or enumeration type initialized by a constant expression.