I seem to be having an odd C++ linker error. It's probably something simple...
I have a singleton template class. Now, obviously this contains a static templated pointer. This needs to be declared, so I do this in a special cpp file, ISingleton.hpp.
Now, if I do a full-on templated declaration of:
template <class T> T* DOM::System::Tools::ISingleton<T>::_pv_singleton = 0;
I get compile-time errors of undefined references to _pv_singleton. Now, if I do this in main.cpp instead of ISingleton.cpp, it compiles and executes without complaint. Similarily, if I specialise the class in ISingleton.cpp, say:
template <> int* DOM::System::Tools::ISingleton<int>::_pv_singleton = 0;
and then create a singleton of type ISingleton<int>, this also compiles fine.
Anybody got any idea why this is screwing with me like this?