原文件如下: #include <windows.h> int WINAPI WinMain (HINSTANCE,HINSTANCE,LPSTR,int); LRESULT WINAPI WndProc (HWND,UINT,WPARAM,LPARAM); int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { HWND hWnd; MSG msg; WNDCLASS wc; if(!hPrevInstance) { wc.style=CS_HREDRAW|CS_VREDRAW; wc.lpfnWndProc=WndProc; wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=hInstance; wc.hIcon=LoadIcon (NULL,IDI_APPLICATION); wc.hCursor=LoadCursor(NULL,IDC_ARROW); wc.hbrBackground=(HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName=NULL; wc.lpszClassName="sdk实例"; RegisterClass(&wc); } hWnd=CreateWindow("sdk 实例", "Win32 SDK 应用程序实例", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow (hWnd,SW_SHOW); UpdateWindow(hWnd); while (GetMessage (&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT WINAPI WndProc (HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { HDC hDC; switch(msg) { case WM_PAINT: hDC=GetDC(hWnd);
TextOut(hDC,10,100,"你好,SDK编程!",sizeof("你好,SDK编程!")-1); break; case WM_DESTROY: PostQuitMessage(0); break; default: break; } return DefWindowProc(hWnd,msg,wParam,lParam); } 编译时没有出错,构建时出现如下错误 LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/SdkMain.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. 请教一下这是什么原因