包含<afxwin.h>时为什么说意外遇到文件结尾?
以前VC6的一个例程 hello world. 因为现在用VC7, 出现这个奇怪的问题.其实代码没什么, 还是帖出来罢.
#include <afxwin.h> //这里出错,用向导生成那个stdafx.h就是好的
#include "hello.h"
ChelloApp theApp;
BOOL ChelloApp::InitInstance()
{
m_pMainWnd = new CMainFrame();
m_pMainWnd->ShowWindow( m_nCmdShow );
m_pMainWnd->UpdateWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
CMainFrame::CMainFrame()
{
Create ( NULL, "Hello" );
}
void CMainFrame::OnPaint()
{
CPaintDC dc ( this );
dc.TextOut ( 0, 0, "Hello");
}
////////////////////////////////头文件/////////////////////////////
class ChelloApp : public CWinApp
{
public:
virtual BOOL InitInstance();
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
protected:
afx_msg void OnPaint ();
DECLARE_MESSAGE_MAP()
};
问题点数:40、回复次数:3Top
1 楼sxslyy(孤松傲雪)回复于 2003-11-04 08:25:34 得分 20
在
#include <afxwin.h>
之前加入
#include "stdafx.h"Top
2 楼yintongshun(左岸思雨)回复于 2003-11-04 09:20:58 得分 20
#include "stdafx.h" REBUILD ALL 如果你的代码有贴来的,可能是UNICODE问题,最好写上或者放到记事本里UNICODE一下Top
3 楼danielhf(我)回复于 2003-11-04 14:06:21 得分 0
我看不像, UNICODE只影响输出的字符串, 我改变成宽字符还是不行, 我怀疑还是预编译头文件的问题, 可能它在建立MFC工程的时候,预编译了头文件,然后在编译器命令行参娄中加了这个开关, 我直接包含这个头文件后,它就找不到预编译的头文件了.Top




