vc++新手编译查错

#include <windows.h>
#include <stdio.h>
LRESULT CALLBACK Winsunproc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_APPSTARTING);
wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=Winsunproc;
wndcls.lpszClassName="牛逼一刀斩";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls);

HWND hwnd;
hwnd=CreateWindow("牛逼一刀斩","我砍我砍我砍砍砍",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
{while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
}

LRESULT CALLBACK Winsunproc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char code is %d",wParam);
MessageBox(hwnd,szChar,"char",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"砍死你丫的","message",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"我砍!",strlen("我砍!"));
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,"我老牛你也敢砍?",strlen("我老牛你也敢砍?"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if (IDYES==MessageBox(hwnd,"是否真的结束?","message",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);

}
}
return 0;
}

报错:--------------------Configuration: WinMain - Win32 Debug--------------------
Compiling...
WinMain.cpp
e:\c\winmain\winmain.cpp(85) : error C2143: syntax error : missing ';' before 'return'
e:\c\winmain\winmain.cpp(86) : error C2143: syntax error : missing ';' before '}'
e:\c\winmain\winmain.cpp(86) : error C2143: syntax error : missing ';' before '}'
e:\c\winmain\winmain.cpp(86) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.

WinMain.exe - 4 error(s), 0 warning(s)

新手问题多多~刚补了几个错的,现在又冒出几个~呵呵
请大家帮帮忙~
地址:http://hi.baidu.com/先锋联盟
那位兄弟,我照你说的做了~但是出现了这么个问题,不是语法错误~该怎么处理哦~等下解决了给你加分
报错:--------------------Configuration: WinMain - Win32 Debug--------------------
Compiling...
WinMain.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WinMain.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

WinMain.exe - 2 error(s), 0 warning(s)

想这种提示一般就是多了一个大括号

把return 前的大括号去掉就可以了 

发现你也够暴力的...“我砍...” 

我拿着你的代码试着去了大括号就好了

我不知道你去是是谁?但是我去的是倒数第二个

温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-07-10
兄弟啊 告诉我们错误的具体定位到哪一行! 85行这不是vc没有自动定位 让我们给你数到85行看啊?累死了!把源码给我 我给你调 应该是括号或者;一般的小问题
程序挺狠的啊 我砍死你。。。。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网