When you have static data members in a class, you have to add a declaration in a source file that is compiled, right?
#ifndef _IMBASE_CPP_
#define _IMBASE_CPP_
#include "list.h"
#include "IMBase.h"
util::list<IMBase*> IMBase::activeList; ///< The list of active objects (with ref_count > 0)
util::list<IMBase*> IMBase::deadList; ///< The list of dead objects (with ref_count == 0)
#endif
#ifndef _IMBASE_H_
#define _IMBASE_H_
#include "list.h"
/**
* Provides the basic menmory managment for objects.
*/
class IMBase
{
private:
static util::list<IMBase*> activeList; ///< The list of active objects (with ref_count > 0)
static util::list<IMBase*> deadList; ///< The list of dead objects (with ref_count == 0)
long ref_count; ///< Reference variable
public:
// functions
};
So, shouldn't this work? I've added the IMBase source file to the project, and the IMBase header is included where it needs to be. Also the list header file is included and the list source file is added to the project.
So, theoretically, shouldn't this be working?
I'm still getting:
IMBase.obj : error LNK2001: unresolved external symbol
"public: __thiscall util::list<class IMBase *>::list<class IMBase *>(void)" (??0?$list@PAVIMBase@@@util@@QAE@XZ)
IMBase.obj : error LNK2001: unresolved external symbol
"public: __thiscall util::list<class IMBase *>::~list<class IMBase *>(void)" (??1?$list@PAVIMBase@@@util@@QAE@XZ)
Debug/test.exe : fatal error LNK1120: 2 unresolved externals
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper