static vector<...> in class problem.
Okay, I've been struggling around with this for a day, I cannot find the solution. Here is my class declaration:
Code:
class CRTLight
{
public:
CRTLight() {Lights++; }
~CRTLight() {Lights--; }
void Pu****();
static int Lights;
static vector<CRTLight*> vList;
};
and my cpp file:
Code:
int CRTLight::Lights = 0;
void CRTLight::Pu****()
{
vList.push_back(this);
}
The compiler (VC++6) complains:
rLight.obj : error LNK2001: unresolved external symbol "public: static class std::vector<class CRTLight *,class std::allocator<class CRTLight *> > CRTLight::vList" (?vList@CRTLight@@2V?$vector@PAVCRTLight@@V?$alloc ator@PAVCRTLight@@@std@@@std@@A)
../bin/rEngine.dll : fatal error LNK1120: 1 unresolved externals
But if I remove the push_back call, it is ok, but i need the call ;)
Any ideas?