It has been a while since I've programmed in C++. I was trying to implement a singleton class, but I get an unresolved external symbol. Can you guys point out out to resolve this problem? Thanks in advance!
class Singleton
{
Singleton(){}
Singleton(const Singleton & o){}
static Singleton * theInstance;
public:
static Singleton getInstance()
{
if(!theInstance)
Singleton::theInstance = new Singleton();
return * theInstance;
}
};
Errors:
Error 3 error LNK1120: 1 unresolved externals
Error 2 error LNK2001: unresolved external symbol
"private: static class Singleton * Singleton::theInstance" (?theInstance@Singleton@@0PAV1@A)