In the following class:
class TestClass
{
public:
int staic testMember;
};
int TestClass::testMember;
I’ve got the following compiler error:
error LNK2005: “public: static float TestClass::testMember” (?testMember@TestClass@@2MA) already defined in TestClass.obj
Note: I’ve tried to simulate the problem in a seperated application but everything worked well there.
I wonder where is the problem here?
Your definition:
…is probably in the same H file as the declaration:
Move the definition to it’s own CPP file. You need to define it only once.