unresolved external symbol
-
My class h file is
class CScale : public CStatic
{
// Construction
public:
CScale();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphCtrl)
public:protected: protected: virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT\* pResult); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX\_VIRTUAL
// Implementation
public:
CFont m_font;
COLORREF *BC, BGC;// Generated message map functions
protected:
//{{AFX_MSG(CScale)
afx_msg BOOL OnPaint(CDC* pDC);
//}}AFX_MSGDECLARE\_MESSAGE\_MAP()
};
I have all the function bodies in the cpp file. When I compile I get:
GraphCtrl.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CScale::GetMessageMap(void)const " (?GetMessageMap@CScale@@MBEPBUAFX_MSGMAP@@XZ)
Release/RunCadMFCDLL.dll : fatal error LNK1120: 1 unresolved externals:confused: thanks for helping, sb
-
My class h file is
class CScale : public CStatic
{
// Construction
public:
CScale();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphCtrl)
public:protected: protected: virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT\* pResult); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX\_VIRTUAL
// Implementation
public:
CFont m_font;
COLORREF *BC, BGC;// Generated message map functions
protected:
//{{AFX_MSG(CScale)
afx_msg BOOL OnPaint(CDC* pDC);
//}}AFX_MSGDECLARE\_MESSAGE\_MAP()
};
I have all the function bodies in the cpp file. When I compile I get:
GraphCtrl.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CScale::GetMessageMap(void)const " (?GetMessageMap@CScale@@MBEPBUAFX_MSGMAP@@XZ)
Release/RunCadMFCDLL.dll : fatal error LNK1120: 1 unresolved externals:confused: thanks for helping, sb
Do you have
BEGIN_MESSAGE_MAP()
in your class' .cpp file?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
My class h file is
class CScale : public CStatic
{
// Construction
public:
CScale();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphCtrl)
public:protected: protected: virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT\* pResult); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX\_VIRTUAL
// Implementation
public:
CFont m_font;
COLORREF *BC, BGC;// Generated message map functions
protected:
//{{AFX_MSG(CScale)
afx_msg BOOL OnPaint(CDC* pDC);
//}}AFX_MSGDECLARE\_MESSAGE\_MAP()
};
I have all the function bodies in the cpp file. When I compile I get:
GraphCtrl.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CScale::GetMessageMap(void)const " (?GetMessageMap@CScale@@MBEPBUAFX_MSGMAP@@XZ)
Release/RunCadMFCDLL.dll : fatal error LNK1120: 1 unresolved externals:confused: thanks for helping, sb
It seems that for your
CScale
control there is no correspondingBEGIN_MESSAGE_MAP
/END_MESSAGE_MAP
zone (created by Class Wizard) in CPP file. Open the CPP file where the implementation ofCScale
class is provided, and check if there is aBEGIN_MESSAGE_MAP
andEND_MESSAGE_MAP
macros here, something like this:BEGIN_MESSAGE_MAP(CScale, CStatic) // . . . END_MESSAGE_MAP()
In addition, check if your CPP file is included in the project, i.e. is listed in the Solution Explorer panel, and is not excluded from build process. Hope it helps.
-
Do you have
BEGIN_MESSAGE_MAP()
in your class' .cpp file?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
My class h file is
class CScale : public CStatic
{
// Construction
public:
CScale();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGraphCtrl)
public:protected: protected: virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT\* pResult); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX\_VIRTUAL
// Implementation
public:
CFont m_font;
COLORREF *BC, BGC;// Generated message map functions
protected:
//{{AFX_MSG(CScale)
afx_msg BOOL OnPaint(CDC* pDC);
//}}AFX_MSGDECLARE\_MESSAGE\_MAP()
};
I have all the function bodies in the cpp file. When I compile I get:
GraphCtrl.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CScale::GetMessageMap(void)const " (?GetMessageMap@CScale@@MBEPBUAFX_MSGMAP@@XZ)
Release/RunCadMFCDLL.dll : fatal error LNK1120: 1 unresolved externals:confused: thanks for helping, sb
What the others have said, and also, if you want ClassWizard to work correctly, you need to make all this stuff match ... // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CGraphCtrl) should be // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CScale) Be careful what you cut and paste - don't forget the edit! I've seen better runs in my shorts! - Patches O'Houlihan