-------------------Configuration: sjfjfhgrg - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/sjfjfhgrg.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
sjfjfhgrg.exe - 2 error(s), 0 warning(s)
我按照书上的例子输的如下的代码:========
//==========================在下面========================
#include "windows.h"
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
//声明窗口处理函数,即窗口函数
int WINAPI WinWaim(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpszCmdLine,int nCmdShow)
{
//上面已经申明了主函数的入口了。
HWND hwnd;//声明了一个用来存储窗口句柄 的变量
MSG Msg;//消息变量
WNDCLASS wndclass;//定义窗口类变量
//下面是两个字符串来标志标题和类
char lpszClassName[]="窗口的字符";
char lpszTitle[]="窗口的标题";
//下面是窗口类的定义
wndclass.style=0;//窗口为默认类型
wndclass.lpfnWndProc=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=lpszClassName;
//下面开始注册窗口
RegisterClass(&wndclass);
//下面创建窗口
hwnd=CreateWindow(
lpszClassName,//窗口类名
lpszTitle,//窗口标题
WS_OVERLAPPEDWINDOW,//窗口风格
CW_USEDEFAULT,//坐标
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,//无父窗体
NULL,//无子菜单
hInstance,//创建次窗口的应用程序的句柄
NULL);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
return 0;
}
LRESULT CALLBACK WndProc(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);
}