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:
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)
Why would this be?
Here is the relevant code in the header
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()
};
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.
The RC file does have a corresponding dlg definition.
EDIT:
Thanks for the DECLARE_DYNAMIC help - now I do not have the GetRuntimClass() error - just the GetMessagemap() error.
You used DECLARE_DYNAMIC but forgot IMPLEMENT_DYNAMIC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With