MFC问题请教! 显示结果:如下图;编译通过,连接失败?请问怎么改正······
#include"afxwin.h"classCMyApp:publicCWinApp{public:CMyApp();public:virtualBOOLInitIns...
#include "afxwin.h"
class CMyApp : public CWinApp
{
public:
CMyApp();
public:
virtual BOOL InitInstance();
};
CMyApp sha;
class CMainFrame : public CFrameWnd
{
public:
CMainFrame()
{ //创建窗口
Create(0,"我的窗口",WS_OVERLAPPEDWINDOW,CRect(0,0,400,300));
}
protected:
afx_msg void OnLButtonDown(UINT,CPoint);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void CMainFrame::OnLButtonDown(UINT nFlags,CPoint point)
{
MessageBox("消息框!");
CMainFrame::OnLButtonDown(nFlags,point);
}
BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMainFrame();
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
error LNK2001: unresolved external symbol "public: __thiscall CMyApp::CMyApp(void)" (??0CMyApp@@QAE@XZ)
Debug/书上第一个MFC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. 展开
class CMyApp : public CWinApp
{
public:
CMyApp();
public:
virtual BOOL InitInstance();
};
CMyApp sha;
class CMainFrame : public CFrameWnd
{
public:
CMainFrame()
{ //创建窗口
Create(0,"我的窗口",WS_OVERLAPPEDWINDOW,CRect(0,0,400,300));
}
protected:
afx_msg void OnLButtonDown(UINT,CPoint);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
void CMainFrame::OnLButtonDown(UINT nFlags,CPoint point)
{
MessageBox("消息框!");
CMainFrame::OnLButtonDown(nFlags,point);
}
BOOL CMyApp::InitInstance()
{
m_pMainWnd=new CMainFrame();
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
error LNK2001: unresolved external symbol "public: __thiscall CMyApp::CMyApp(void)" (??0CMyApp@@QAE@XZ)
Debug/书上第一个MFC.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询