报错:
error LNK2001: unresolved external symbol "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/NoteBook.exe : fatal error LNK1120: 2 unresolved externals
源码
/*----------------------------------------
NoteBookdante BAN meta_yy2010
----------------------------------------*/
#include
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hIstance,HINSTANCE hInstance,LPSTR lpCmdLine,int iCmdShow)
{
static TCHAR szAppName[] = TEXT("NoteBook by something");
HWNDhwnd;
MSG msg;
WNDCLASS ws;
ws.style = CS_HREDRAW | CS_VREDRAW;
ws.lpfnWndProc = WndProc;
ws.cbClsExtra = 0;
ws.cbWndExtra = 0;
ws.hInstance = hInstance;
ws.hIcon = LoadIcon(NULL,IDI_APPLICATION);
ws.hCursor = LoadCursor(NULL,IDC_ARROW);
ws.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
ws.lpszMenuName = NULL;
ws.lpszClassName = szAppName;
if(!RegisterClass(&ws))
{
MessageBox(NULL,TEXT(" OHNO"),szAppName,MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(
szAppName,// registered class name
TEXT("NOTEBOOK"), // window name
WS_OVERLAPPEDWINDOW,
// window style
30,
// horizontal position of window
30,
// vertical position of window
500,
// window width
300,
// window height
NULL,
// handle to parent or owner window
NULL,
// menu handle or child identifier
hInstance,// handle to application instance
NULL
// window-creation data
);
ShowWindow(hwnd,iCmdShow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WinProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCTps;
RECTrect;
switch(message)
{
case WM_CREATE:
MessageBox(NULL,TEXT("Create Window"),TEXT("note"),MB_ICONERROR);
return 0;
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
DrawText(hdc,TEXT("HELLO WINDOWS"),-1,&rect,DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint(hwnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}
另自学SDK中的朋友可以加个Q指点一下新手
1136018016
VC++6.0下报错,创建的是win32控制台应用程序,。。
|