新人求帮忙LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug
编译的时候老是出现错误提示,怎么找也不知道错在哪里,请高手帮忙指点LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/005.exe : fatal error LNK1120: 1 unresolved externals
下面是代码:
#include<stdio.h>
#include<windows.h>
LRESULT CALLBACK winlzy(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndclass;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=(HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.hCursor=LoadCursor(NULL,IDC_APPSTARTING);
wndclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=winlzy;
wndclass.lpszClassName="lzy";
wndclass.lpszMenuName=NULL;
wndclass.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndclass);
HWND hwnd;
hwnd=CreateWindow("lzy","weixin",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_NORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK winlzy(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_PAINT:
HDC hdc1;
PAINTSTRUCT ps;
hdc1=BeginPaint(hwnd,&ps);
TextOut(hdc1,0,0,"好好学习",strlen("好好学习"));
EndPaint(hwnd,&ps);
break;
case WM_CHAR:
char szchar[20];
sprintf(szchar,"char is %d",wParam);
MessageBox(hwnd,szchar,"weixin",MB_OK);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","weixin",MB_OK);
HDC hdc2;
hdc2=GetDC(hwnd);
TextOut(hdc2,0,50,"天天向上",strlen("天天向上"));
ReleaseDC(hwnd,hdc2);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"是否真的结束程序?","weixin",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}