c++ 单列模式错误了 求解哪错了
c++吧
全部回复
仅看楼主
level 5
#include<iostream>
struct singe
{
private:
singe()
{
std::cout<<"singe()"<<std::endl;
};
~singe()
{
std::cout<<"~singe()"<<std::endl;
};
static singe* singer;
public:
static singe* getsinge()
{
if(singer == NULL)
{
singer = new singe();
}
return singer;
};
};
int main()
{
singe* a = singe::getsinge();
}

2012年04月30日 06点04分 1
level 5
错误 1 error LNK2001: 无法解析的外部符号 "private: static struct singe * singe::singer" (?singer@singe@@0PAU1@A) test.obj test
2012年04月30日 06点04分 2
level 5
错误 2 fatal error LNK1120: 1 个无法解析的外部命令 E:\VS\Project1\test\Debug\test.exe test
2012年04月30日 06点04分 3
level 5
where where?
2012年04月30日 06点04分 5
level 5
单词拼错了 什么意思能详解吗?
2012年04月30日 06点04分 6
level 11
代码太乱,不看
2012年04月30日 06点04分 8
level 5
真的很乱吗?不会吧别打击我![拍砖]
2012年04月30日 06点04分 10
level 5
还是不行呃
2012年04月30日 06点04分 11
level 5
vs2008
2012年04月30日 06点04分 13
level 5
再写个public函数调用析构函数,和构造一样吧。
关键是编译通过不了啊
2012年04月30日 07点04分 15
level 5
singe *singe::singer = NULL;
这句很重要吗 感觉加不加无所谓啊 singer我没赋值本来就是NULL吗!
2012年04月30日 07点04分 16
level 5
错误 1 error LNK2001: 无法解析的外部符号 "private: static struct singe * singe::singer" (?singer@singe@@0PAU1@A) test.obj test
天哪 我这个程序也不行啊
int main()
{
std::cout<<"Hello World!";
}
2012年04月30日 07点04分 18
level 5
也有
错误 2 fatal error LNK1120: 1 个无法解析的外部命令 E:\VS\Project1\test\Debug\test.exe test
2012年04月30日 07点04分 20
1 2 尾页