菜鸟MFC 求指导

wanfengsong 2012-05-20 11:36:00
我想学windows应用编程,着两天看了哈mfc在书上抄了这个程序想试试运行科遇到的错误提示是这样的
“--------------------Configuration: test5 - Win32 Debug--------------------
Compiling...
t5_hello.cpp
D:\vc++6.0\vc\test5\t5_hello.cpp(7) : error C2504: 'CWinApp' : base class undefined
D:\vc++6.0\vc\test5\t5_hello.cpp(19) : error C2504: 'CFrameWnd' : base class undefined
D:\vc++6.0\vc\test5\t5_hello.cpp(20) : error C2143: syntax error : missing ';' before '*'
D:\vc++6.0\vc\test5\t5_hello.cpp(20) : error C2501: 'CStatic' : missing storage-class or type specifiers
D:\vc++6.0\vc\test5\t5_hello.cpp(20) : error C2501: 'cs' : missing storage-class or type specifiers
D:\vc++6.0\vc\test5\t5_hello.cpp(29) : error C2065: 'm_pMainWnd' : undeclared identifier
D:\vc++6.0\vc\test5\t5_hello.cpp(29) : error C2061: syntax error : identifier 'CHelloWindow'
D:\vc++6.0\vc\test5\t5_hello.cpp(30) : error C2227: left of '->ShowWindow' must point to class/struct/union
D:\vc++6.0\vc\test5\t5_hello.cpp(30) : error C2065: 'm_nCmdShow' : undeclared identifier
D:\vc++6.0\vc\test5\t5_hello.cpp(31) : error C2227: left of '->UpdateWindow' must point to class/struct/union
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : error C2143: syntax error : missing ';' before '}'
................................
D:\vc++6.0\vc\test5\t5_hello.cpp(33) : fatal error C1003: error count exceeds 100; stopping compilation
执行 cl.exe 时出错.”全是
BOOL CHelloApp::InitInstance()
{
m_pMainWnd = new CHelloWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}里的出错,因为新手不知道怎么搞。请大神们知道哈,下面是抄的代码。谢谢啊!

t5_hello.obj - 1 error(s), 0 warning(s)


//hello.cpp

#include <afxwin.h>
#include <stdafx.h>
//说明应用程序类
class CHelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};

//建立应用程序类的应用

CHelloApp HelloApp;

//说明主窗口类

class CHwlloWindow : public CFrameWnd
{
CStatic* cs;
public:
CHelloWindow();
};

//每当应用程序首次执行时都要调用的初始化函数



//窗口类的构造函数

CHelloWindow::CHelloWindow()
{
//建立窗口本身

Create(NULL,"hello Woeld!",WS_OVERLAPPEDWINDOW,CRect(0,0,200,200));


//建立静态标签

cs = new CStatic();
cs->Create("hello world",WS_CHILD|WS_VISIBLE|SS_CENTER,CReate(50,80,150,150),this);
}



...全文
73 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

64,318

社区成员

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

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