菜鸟提问:visual c++ 技术内幕第四版的第一个例子怎么运行不了呢

wx3046 2009-09-05 10:25:24
.h文件:

class CMyApp:public CWinApp
{
public:
virtual BOOL InitInstance();
};

class CMyFrame: public CFrameWnd
{
public:
CMyFrame();
protected:
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP();
};


.cpp文件


#include <afxwin.h>
#include "app.h"

CMyApp theApp;

BOOL CMyApp::InitInstance()
{
m_pMainWnd = new CMyFrame();
m_pMainWnd->ShowWindow(m_nCmdShow);

m_pMainWnd->UpdateWindow();
return TRUE;
}

BEGIN_MESSAGE_MAP(CMyFrame, CFrameWnd)
ON_WM_LBUTTONWODN()
ON_WM_PAINT()
END_MESSAGE_MAP()

CMyFrame::CMyFrame()
{
Create(NULL, "MYAPP Application");
}

void CMyFrame::OnLButtonDown(UINT nFlags, CPoint point)
{
TRACE("Entering CMyFrame::OnLButtonDown - %1x, %d, %d\n",
(long) nFlags, point.x,point.y);
}

void CMyFrame::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0, 0, "Hello,World!");
}



错误提示:
--------------------Configuration: app - Win32 Debug--------------------
Compiling...
app.cpp
G:\MFC\app\app.cpp(16) : error C2065: 'ON_WM_LBUTTONWODN' : undeclared identifier
G:\MFC\app\app.cpp(17) : error C2059: syntax error : '{'
G:\MFC\app\app.cpp(17) : error C2143: syntax error : missing ';' before '{'
G:\MFC\app\app.cpp(17) : error C2447: missing function header (old-style formal list?)
G:\MFC\app\app.cpp(17) : error C2143: syntax error : missing ';' before ','
G:\MFC\app\app.cpp(18) : error C2143: syntax error : missing ';' before '{'
G:\MFC\app\app.cpp(18) : error C2447: missing function header (old-style formal list?)
G:\MFC\app\app.cpp(18) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.

app.obj - 8 error(s), 0 warning(s)

郁闷哦
...全文
47 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
na2650945 2009-09-06
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ilysony 的回复:]
语法都有错呀
[/Quote]
正解。
貌似全是语法的错误。
对照书检查一遍。
就出来了。
Sou2012 2009-09-06
  • 打赏
  • 举报
回复
语法都有错呀
jean7155 2009-09-05
  • 打赏
  • 举报
回复
这个就是全部代码?!

wx3046 2009-09-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 jean7155 的回复:]
有看没有懂。
今天刚刚看了mfc的东西,我想试试。
有代码吗打包传上来看看?
[/Quote]

没代码额。。这个是我看着书敲进去的
jean7155 2009-09-05
  • 打赏
  • 举报
回复
有看没有懂。
今天刚刚看了mfc的东西,我想试试。
有代码吗打包传上来看看?

64,646

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧