博士读到第4年,不知道PI什么意思# Biology - 生物学
n*r
1 楼
在Visual Studio上编译总是有错,哪位大侠能不能帮我看看是什么原因?
error LNK2019: unresolved external symbol "private: __thiscall
Singleton2::Singleton2(void)" ([email protected]@@[email protected])
referenced in function "public: static class Singleton2 * __cdecl
Singleton2::GetInstance(void)" (?
[email protected][email protected]@@[email protected])
// Singleton.h
template class Singleton2
{
private:
Singleton2(void);
~Singleton2(void);
Singleton2(const Singleton2&);
Singleton2& operator=(const Singleton2&);
static Singleton2* instance;
public:
static Singleton2* GetInstance();
};
template Singleton2* Singleton2::instance = NULL;
template Singleton2* Singleton2::GetInstance()
{
if ( instance == NULL )
instance = new Singleton2;
return instance;
}
// Main program
#include "Singleton2.h"
void main()
{
Singleton2* s1 = Singleton2::GetInstance();
}
error LNK2019: unresolved external symbol "private: __thiscall
Singleton2
referenced in function "public: static class Singleton2
Singleton2
[email protected][email protected]@@[email protected])
// Singleton.h
template
{
private:
Singleton2(void);
~Singleton2(void);
Singleton2(const Singleton2&);
Singleton2& operator=(const Singleton2&);
static Singleton2* instance;
public:
static Singleton2* GetInstance();
};
template
template
{
if ( instance == NULL )
instance = new Singleton2;
return instance;
}
// Main program
#include "Singleton2.h"
void main()
{
Singleton2
}