error LNK2001: unresolved external symbol "public: static XXXXXXXXXX
2013-03-31 01:01
330 查看
这种错误最蛋疼了。因为是链接时发生错误。
总结了一下,有以下几种可能性:
(1)你的类的某些方法没有在CPP中实现,常体现为构造函数,析构函数等没有实现
(2)在另外一个类中使用一个类的静态成员变量,这个静态成员一定要被赋初值,且在这条赋值语句前端加上该变量的类型(即看上去好像声明一个新的变量一样。)。
多数选择在另外一个类的实现CPP中的开头初始化。
或者是在类定义时声明这个静态变量的同时给予它初值,这是个良好的习惯。
总结了一下,有以下几种可能性:
(1)你的类的某些方法没有在CPP中实现,常体现为构造函数,析构函数等没有实现
(2)在另外一个类中使用一个类的静态成员变量,这个静态成员一定要被赋初值,且在这条赋值语句前端加上该变量的类型(即看上去好像声明一个新的变量一样。)。
多数选择在另外一个类的实现CPP中的开头初始化。
或者是在类定义时声明这个静态变量的同时给予它初值,这是个良好的习惯。
相关文章推荐
- error LNK2001: unresolved external symbol "public: static ... 解决一法
- error LNK2001: unresolved external symbol \"public: __thiscall。。。
- error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const (转)
- error LNK2001: unresolved external symbol "public: virtual __thiscall CppUnit的解决办法
- 问题error LNK2001: unresolved external symbol "public: static class解决
- error LNK2001: unresolved external symbol "public: __thiscall
- error LNK2001: unresolved external symbol "__declspec(dllimport) public:
- 浅析error LNK2001: unresolved external symbol "public: __thisc...
- 浅析error LNK2001: unresolved external symbol "public: __thiscall
- 错误:error LNK2001: unresolved external symbol "public: __thiscall
- 错误提示:error LNK2001: unresolved external symbol "public: static int person::weight" (?weight@person@@
- error LNK2001: unresolved external symbol "public: __thiscall CWinAppEx::CWinAppEx(int)" (??0CWinApp
- song2013 error LNK2001: unresolved external symbol "public: virtual
- 关于error LNK2001: unresolved external symbol "__declspec(dllimport) public
- error LNK2001: unresolved external symbol "public: int __thiscal
- 关于"testencodefile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public"
- error LNK2001: unresolved external symbol "public: __thiscall Point::~Point(void)" (??1Point@@QAE@XZ
- error LNK2001:unresolved external symbol "public: __thiscall 类名::函数名
- error LNK2001: unresolved external symbol "public: int __thiscall CFtProtocolThread::getFnIds(class _STL::vector > &)" (?getFnId
- error LNK2001: unresolved external symbol "public: void __thiscall CDvrRecordOpt::Terminate(void)"