Link error question
-
I got a linking problem. I think it has something to do with MFC and such but I`m not sure.. The problem is as follows: I made a .dll file and in it is a class derived from CDialog, something like:
#ifdef __DLL_BUILD__ #define LD_DECSPEC __declspec(dllexport) #else #define LD_DECSPEC __declspec(dllimport) #endif class LD_DECSPEC CDllDialog : public CDialog { public: CDllDialog( CWnd* pParent = NULL ); CDllDialog( UINT nIDD, CWnd* pParent = NULL ); virtual ~CDllDialog(); // Dialog Data //{{AFX_DATA(CDllDialog ) // NOTE: the ClassWizard will add data members here //}}AFX_DATA enum{ ID_DLG_LOGOUT = 200 }; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDllDialog) public: virtual BOOL PreTranslateMessage( MSG* pMsg ); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CDllDialog ) virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
In another project I want to derive another dialog from that dialog like:class CDLG_AppSelect : public CDllDialog { public: CDLG_AppSelect(CWnd* pParent = NULL); // Dialog Data //{{AFX_DATA(CDLG_AppSelect) enum { IDD = IDD_LOGINAPP_DIALOG }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDLG_AppSelect) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: CLD_Button m_btnCancel; CLD_Static m_statDlgTitle; void CreateControls(); // Generated message map functions //{{AFX_MSG(CDLG_AppSelect) virtual BOOL OnInitDialog(); afx_msg virtual int OnPressCancel(); afx_msg virtual int OnStartApplication(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
The error I got is: DLG_AppSelect.obj : error LNK2019: unresolved external symbol "protected: static struct AFX_MSGMAP const CDllDialog::messageMap" (?messageMap@CDllDialog@@1UAFX_MSGMAP@@B) referenced in function "protected: static struct AFX_MSGMAP const * __cdecl C DLG_AppSelect::_GetBaseMessageMap(void)" (?_GetBaseMessageMap@CDLG_AppSelect@@KAPBUAFX_MSGMAP@@XZ) So it looks it has something to do with the DECLARE_MESSAGE_MAP macro or something... Does anyone know how to solve this problem? Thanks for any info you can provide Davy -
I got a linking problem. I think it has something to do with MFC and such but I`m not sure.. The problem is as follows: I made a .dll file and in it is a class derived from CDialog, something like:
#ifdef __DLL_BUILD__ #define LD_DECSPEC __declspec(dllexport) #else #define LD_DECSPEC __declspec(dllimport) #endif class LD_DECSPEC CDllDialog : public CDialog { public: CDllDialog( CWnd* pParent = NULL ); CDllDialog( UINT nIDD, CWnd* pParent = NULL ); virtual ~CDllDialog(); // Dialog Data //{{AFX_DATA(CDllDialog ) // NOTE: the ClassWizard will add data members here //}}AFX_DATA enum{ ID_DLG_LOGOUT = 200 }; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDllDialog) public: virtual BOOL PreTranslateMessage( MSG* pMsg ); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CDllDialog ) virtual BOOL OnInitDialog(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
In another project I want to derive another dialog from that dialog like:class CDLG_AppSelect : public CDllDialog { public: CDLG_AppSelect(CWnd* pParent = NULL); // Dialog Data //{{AFX_DATA(CDLG_AppSelect) enum { IDD = IDD_LOGINAPP_DIALOG }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDLG_AppSelect) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: CLD_Button m_btnCancel; CLD_Static m_statDlgTitle; void CreateControls(); // Generated message map functions //{{AFX_MSG(CDLG_AppSelect) virtual BOOL OnInitDialog(); afx_msg virtual int OnPressCancel(); afx_msg virtual int OnStartApplication(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
The error I got is: DLG_AppSelect.obj : error LNK2019: unresolved external symbol "protected: static struct AFX_MSGMAP const CDllDialog::messageMap" (?messageMap@CDllDialog@@1UAFX_MSGMAP@@B) referenced in function "protected: static struct AFX_MSGMAP const * __cdecl C DLG_AppSelect::_GetBaseMessageMap(void)" (?_GetBaseMessageMap@CDLG_AppSelect@@KAPBUAFX_MSGMAP@@XZ) So it looks it has something to do with the DECLARE_MESSAGE_MAP macro or something... Does anyone know how to solve this problem? Thanks for any info you can provide DavyYou forget this combination in one of file,
BEGIN_MESSAGE_MAP(CMyDlg, CBaseDlg)
END_MESSAGE_MAP()Prasad Notifier using ATL | Operator new[],delete[][^]
-
You forget this combination in one of file,
BEGIN_MESSAGE_MAP(CMyDlg, CBaseDlg)
END_MESSAGE_MAP()Prasad Notifier using ATL | Operator new[],delete[][^]
-
no, both .cpp files contain the BEGIN_MESSAGE_MAP -- END_MESSAGE_MAP block. The problem must lie somewhere else. Thanks for you input anyway. Davy
GDavy wrote:
BEGIN_MESSAGE_MAP -- END_MESSAGE_MAP block.
Can you show how you have used in both cpp?
Prasad Notifier using ATL | Operator new[],delete[][^]