Possible Duplicate:
What does it mean to have an undefined reference to a static member?
Currently I have the following code File: TestClass.h
class TestClass
{
private:
int i;
static TestClass* TClass;
public:
static TestClass* GetClass()
{
if(TClass==NULL)
{
TClass = new TestClass();
return TClass;
}
else
{
return TClass;
}
}//end method
int Geti()
{
return i;
}
void Seti(int a)
{
i = a;
}
};
Now I have a method in my cpp file after including the header as
declspec(dllexport) int __stdcall GetVar()
{
TestClass *TClass = TestClass::GetClass();
return TClass->Geti();
}
The error I get is:
Error 8 error LNK2001: unresolved external symbol "private: static class TestClass * TestClass::TClass" (?TClass@TestClass@@0PEAV1@EA)