| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1399 人关注过本帖
标题:求助 不知道出错在哪里
取消只看楼主 加入收藏
vs91shine
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-10-25
收藏
 问题点数:0 回复次数:1 
求助 不知道出错在哪里

//MFCWindow.h

//应用程序类
class CMFCApp: public CWinApp
{
public:
virtual BOOL InitInstance();
};


//主窗口类
class CMFCWindow(): public CFrameWnd
{
public:
CMFCWindow();
protected:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};


//MFCWindow.cpp

#include "afxwin.h"
#include "MFCWindow.h"


//声明应用程序类的实例
CMFCApp mfcApp;

//每当应用程序首次执行时都要调用的初始化函数
BOOL CMFCApp::InitInstance()
{
m_pMainWnd=new CMFCWindow();
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();

return TRUE;
}


//建立消息映射
BEGIN_MESSAGE_MAP(CMFCWindow,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()


//窗口类的构造函数
CMFCWindow::CMFCWindow()
{
Create(NULL,_T("使用MFC编写应用程序"));
}


//对WM_PAINT消息进行响应
void CMFCWindow::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);

//在屏幕中央显示文字
dc.DrawText(_T("欢迎使用MFC"),-1,&rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}

怎么会编译通不过啊?

搜索更多相关主题的帖子: public 应用程序 MFCWindow quot include 
2006-10-27 08:17
vs91shine
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-10-25
收藏
得分:0 

--------------------Configuration: MFCWindow - Win32 Debug--------------------
Compiling...
MFCWindow.cpp
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(4) : error C2504: 'CWinApp' : base class undefined
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(6) : error C2146: syntax error : missing ';' before identifier 'InitInstance'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(6) : error C2433: 'BOOL' : 'virtual' not permitted on data declarations
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(6) : error C2501: 'BOOL' : missing storage-class or type specifiers
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(11) : error C2059: syntax error : 'public'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(13) : error C2143: syntax error : missing ';' before 'public'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(15) : error C2143: syntax error : missing ';' before 'protected'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(17) : error C2065: 'DECLARE_MESSAGE_MAP' : undeclared identifier
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(18) : error C2143: syntax error : missing ';' before '}'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.h(18) : warning C4508: 'CMFCWindow' : function should return a value; 'void' return type assumed
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.cpp(8) : error C2143: syntax error : missing ';' before 'tag::id'
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.cpp(8) : error C2501: 'BOOL' : missing storage-class or type specifiers
c:\documents and settings\administrator\桌面\mfc\mfcwindow\mfcwindow.cpp(8) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\MFCWindow.sbr': No such file or directory
执行 bscmake.exe 时出错.

MFCWindow.exe - 1 error(s), 0 warning(s)

2006-10-27 11:32
快速回复:求助 不知道出错在哪里
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037354 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved