编译一个最简单的VC++程序,出现以下错误:
fatal error C1010: unexpected end of file while looking for precompiled header directive
执行 cl.exe 时出错.
网上的方法都不管用.请各位大侠相助.
源文件:standard.cpp:
// WinStardard.cpp : Defines the entry point for the application.
//
#include <windows.h>
LRESULT WINAPI MainWndProc(HWND,UINT,WPARAM,LPARAM);
HANDLE ghInstance;
//Start WinMain
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
WHDCLASS wc;
MSG msg;
HWND hWnd;
if(!hPrevInstance)
{
wc.lpszClassName="standardAppClass";
wc.lpfnWndProc=MainWndProc;
wc.style=CS_OWNDC|CS_VREDRAW|CS_HREDRAW;
wc.hInstance=hInstance;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hbrbackground=(HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName=NULL;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
RegisterClass(&wc);
}
ghInstance=hInstance;
hWnd=CreateWindow("standardAppClass",
"standard Application",
WS_OVERAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
0,
0,
CW_USERDEFAULT,
CW_USERDEFAULT,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd,nCmdShow);
while(GetMessage(&msg,NULL,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
//Funcion MainWndProc
LRESULT CALLBACK MainWndProc(HWND hWnd,UINT msg,WPARAM wParam,
LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hDc;
switch(msg){
case WM_PAINT:
hDc-BeginPaint(hWnd,&ps);
TextOut(hDc,10,10,"Hello,World!",13);
EndPaint(hWnd,&ps);
break;
case WM_LBUTTONDOWN:
MessageBox(NULL,"跨过长城,走向世界!","^_^,MB_OK);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return(DefWindowProc(hWnd,msg,wParam,lParam));
}
return 0;
}
---------------
注,如果加上#include "stdafx.h"就会返回一堆错误