//The project file is FRAME.IDE
//Source file is FRAME.C
//The framework of Windows 98 Applicationhas no
//resource file, header file, and definition file
#include "windows.h"
LRESULT CALLBACK WindowFunc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
char szWinName [] = "MyWin";
int WINAPI WinMain (HINSTANCE hThisInst, HINSTANCE hPrevinst, LPSTR IpszArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASS wcl;
wcl.hInstance = hThisInst;
wcl.lpszClassName = szWinName;
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon (NULL,IDI_APPLICATION);
wcl.hCursor = LoadCursor (NULL,IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH);
if (! RegisterClass (&wcl) ) return 0;
hwnd = CreateWindow (
szWinName,
"试验",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL
);
ShowWindow (hwnd, nWinMode);
UpdateWindow (hwnd);
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WindowFunc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp2.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
这是书中的例子,在集成开发环境7.4下却可以执行,这是怎么回事?