无法解析的外部符号 "public: virtual struct CRuntimeClass
2013-01-08 10:14
417 查看
无法解析的外部符号 "public: virtual struct CRuntimeClass * __thiscall CMessageBox::GetRuntimeClass(void)const "
以下原因是会引起上述错误的:
1,在.h文件中写了DECLARE_DYNAMIC,而在.cpp文件中没有写IMPLEMENT_DYNAMIC
2,在.h文件中写了DECLARE_DYNCREATE ,但在.cpp文件中没有写上IMPLEMENT_DYNCREATE
在编写自定义类时,你必须知道,如果在类定义中包含了DECLARE_DYNAMIC,那你必须在类声明中包含IMPLEMENT_DYNAMIC;如果在类定义中包含了DECLARE_DYNCREATE,你必须在类声明中包含IMPLEMENT_DYNCREATE
.h类中定义
DECLARE_DYNCREATE(CMyWinThread)
DECLARE_MESSAGE_MAP()
.cpp类中定义
IMPLEMENT_DYNAMIC(CMyWinThread,CWinThread)
BEGIN_MESSAGE_MAP(CMyWinThread, CWinThread)
END_MESSAGE_MAP()
只需要记住:消息映射在.h文件和.cpp文件中是一一对应的。
以下原因是会引起上述错误的:
1,在.h文件中写了DECLARE_DYNAMIC,而在.cpp文件中没有写IMPLEMENT_DYNAMIC
2,在.h文件中写了DECLARE_DYNCREATE ,但在.cpp文件中没有写上IMPLEMENT_DYNCREATE
在编写自定义类时,你必须知道,如果在类定义中包含了DECLARE_DYNAMIC,那你必须在类声明中包含IMPLEMENT_DYNAMIC;如果在类定义中包含了DECLARE_DYNCREATE,你必须在类声明中包含IMPLEMENT_DYNCREATE
.h类中定义
DECLARE_DYNCREATE(CMyWinThread)
DECLARE_MESSAGE_MAP()
.cpp类中定义
IMPLEMENT_DYNAMIC(CMyWinThread,CWinThread)
BEGIN_MESSAGE_MAP(CMyWinThread, CWinThread)
END_MESSAGE_MAP()
只需要记住:消息映射在.h文件和.cpp文件中是一一对应的。
相关文章推荐
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- LNK2001:无法解析的外部符号 "public: virtual struct CRuntimeClass *
- MFC 创建UI 线程 || 无法解析的外部符号 "public: virtual struct CRuntimeClass
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- 错误:无法解析的外部符号"public:virtual struct CRuntimeClass...."
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- QT中添加Q_OBJECT时编译提示obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const错误解决方法
- vs2010+qt4编译出现error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject等错误
- error LNK2001: 无法解析的外部符号 "public: virtual long __stdcall CBaseFilter
- 无法解析的外部符号 "protected: virtual struct wxEventTable const * __thiscal
- 使用log4cplus时遇到的链接错误:无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall
- error LNK2001: 无法解析的外部符号 "public: virtual long __stdcall CBaseFilter
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall ****::metaObj
- error LNK2001: 无法解析的外部符号 "public: static struct QMetaObject const
- QT + VS2005 编译出现 error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject 错误
- error LNK2001: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> > 的解决办法
- error LNK2001: 无法解析的外部符号 "public: virtual int __thiscall Game::LevelTwo(void)"