MFC dlg class link errors for MyClass::GetMessageMap() and MyClass::GetRuntimeClass (MSVC 2008)(MyClass::GetMessageMap() 和 MyClass::GetRuntimeClass (MSVC 2008) 的 MFC dlg 类链接错误)
问题描述
我复制了 dlg 框类的现有标题(使用 dlg 类向导/mfc 向导创建).在我将 cpp 文件添加到项目之前,一切似乎都很好.现在我得到一些 mfc 魔术方法的奇怪链接错误:
I copied an existing header for a dlg box class (created with the dlg class wizard/mfc wizard). All seemed to go fine until I added the cpp file to the project. Now i get odd link errors for some mfc magic methods:
错误 LNK2001:未解决的外部符号公共:虚拟结构CRuntimeClass * __thiscallDlgGapWindow::GetRuntimeClass(void)const"(?GetRuntimeClass@DlgGapWindow@@UBEPAUCRuntimeClass@@XZ)
error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall DlgGapWindow::GetRuntimeClass(void)const " (?GetRuntimeClass@DlgGapWindow@@UBEPAUCRuntimeClass@@XZ)
错误 LNK2001:未解决的外部符号受保护:虚拟结构AFX_MSGMAP 常量 * __thiscallDlgGapWindow::GetMessageMap(void)const"(?GetMessageMap@DlgGapWindow@@MBEPBUAFX_MSGMAP@@XZ)
error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall DlgGapWindow::GetMessageMap(void)const " (?GetMessageMap@DlgGapWindow@@MBEPBUAFX_MSGMAP@@XZ)
为什么会这样?
这是标题中的相关代码
class DlgGapWindow : public CDialog
{
DECLARE_DYNAMIC(DlgGapWindow)
public:
DlgGapWindow(CWnd* pParent = NULL);
virtual ~DlgGapWindow();
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual BOOL OnInitDialog();
enum { IDD = IDD_DIALOG_GAP_VIEW };// Dialog Data
GapViewer m_chart;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSizing(UINT fwSide, LPRECT pRect) ;
afx_msg void OnTimer(ONTIMER_TYPE nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnClose();
afx_msg void OnActivate(UINT,CWnd *,BOOL);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
};
我没有从我建模的课程中看到任何东西似乎丢失了.我没有发现任何有用的谷歌或其他搜索来说明为什么这些神奇的 mfc 东西丢失了.我的其他类没有明确定义它们,它们也没有错误.
I don't see anything from the class I modeled it after that seems to be missing. I have not found anything useful with google or other searches to indicate why these magic mfc things are missing. My other classes don't explicitly define them and they don't have errors.
RC 文件确实有对应的 dlg 定义.
The RC file does have a corresponding dlg definition.
感谢 DECLARE_DYNAMIC 的帮助 - 现在我没有 GetRuntimClass() 错误 - 只有 GetMessagemap() 错误.
Thanks for the DECLARE_DYNAMIC help - now I do not have the GetRuntimClass() error - just the GetMessagemap() error.
推荐答案
你使用了 DECLARE_DYNAMIC 但忘记了 IMPLEMENT_DYNAMIC.
You used DECLARE_DYNAMIC but forgot IMPLEMENT_DYNAMIC.
这篇关于MyClass::GetMessageMap() 和 MyClass::GetRuntimeClass (MSVC 2008) 的 MFC dlg 类链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MyClass::GetMessageMap() 和 MyClass::GetRuntimeClass (MSVC 2008) 的 MFC dlg 类链接错误
基础教程推荐
- 常量变量在标题中不起作用 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 这个宏可以转换成函数吗? 2022-01-01
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
