加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – MyClass :: GetMessageMap()和MyClass :: GetRuntimeClass(

发布时间:2020-12-16 04:56:44 所属栏目:百科 来源:网络整理
导读:我复制了一个dlg box类的现有头文件(使用dlg类向导/ mfc向导创建).在我将cpp文件添加到项目之前,一切似乎都没问题.现在我得到一些mfc魔术方法的奇怪链接错误: error LNK2001: unresolved external symbol “public: virtual struct CRuntimeClass * __thisc
我复制了一个dlg box类的现有头文件(使用dlg类向导/ mfc向导创建).在我将cpp文件添加到项目之前,一切似乎都没问题.现在我得到一些mfc魔术方法的奇怪链接错误:

error LNK2001: unresolved external
symbol “public: virtual struct
CRuntimeClass * __thiscall
DlgGapWindow::GetRuntimeClass(void)const

(?GetRuntimeClass@DlgGapWindow@@UBEPAUCRuntimeClass@@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缺失.我的其他类没有明确定义它们,也没有错误.

RC文件确实有相应的dlg定义.

编辑:

感谢DECLARE_DYNAMIC帮助 – 现在我没有GetRuntimClass()错误 – 只是GetMessagemap()错误.

解决方法

您使用了DECLARE_DYNAMIC但忘记了 IMPLEMENT_DYNAMIC.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读