Thank you, Harvey Undefined symbols: "Singleton<SingleClass>::ptr", referenced from: __ZN9SingletonI11SingleClassE3ptrE$non_lazy_ptr in ccvXYIGQ.o ld: symbol(s) not found collect2: ld returned 1 exit status #include <stdio.h> template<class Type> class Singleton { public: static Type *ptr; protected: Singleton() { ptr = NULL; } ~Singleton() { } }; class SingleClass : public Singleton<SingleClass> { friend class Singleton<SingleClass>; }; template class Singleton<SingleClass>; template <class Type> Type * Singleton<Type>::ptr; // a test //SingleClass * Singleton<SingleClass>::ptr; int main() { return(0); }
Attachment:
PGP.sig
Description: This is a digitally signed message part