无法解析的外部符号 "public: virtual struct CRuntimeClass
2017-06-28 10:34
441 查看
原博地址:http://blog.csdn.net/changbaolong/article/details/8479775
无法解析的外部符号 "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文件中是一一对应的。
无法解析的外部符号 "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文件中是一一对应的。
相关文章推荐
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- MFC 创建UI 线程 || 无法解析的外部符号 "public: virtual struct CRuntimeClass
- LNK2001:无法解析的外部符号 "public: virtual struct CRuntimeClass *
- 错误:无法解析的外部符号"public:virtual struct CRuntimeClass...."
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- 无法解析的外部符号 "public: virtual struct CRuntimeClass
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall ****::metaObj
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __cdecl MainWindow::metaObject(
- vs2010+qt4编译出现error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject等错误
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall MainWindow::metaObje
- QT + VS2005 编译出现 error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject 错误
- QT无法解析的外部符号"public:virtualstructQMetaObjectconst*__thiscallWidget::metaObject"
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- QT中添加Q_OBJECT时编译提示obj : error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const错误解决方法
- error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObject
- error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: struct std::_Wrap_alloc<class std::allocator
- 使用log4cplus时遇到的链接错误:无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,
- QT error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject const * __thiscall Widget::metaObjec