读书人

fatal error C1075: 与左侧的 大括号“

发布时间: 2012-04-17 15:06:33 作者: rapoo

fatal error C1075: 与左侧的 大括号“{”(位于“f:\windows\实验四\beeper1\beeper1.c(202)”)匹配之前遇到文
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam)
{
static long nXChar,nCaps,nYChar;
HDC hDC; //定义指向设备上下文的句柄
short x;
TEXTMETRIC tm;
short LnCount=6;
PAINTSTRUCT PtStr; //定义指向包含绘图信息的结构体变量
static char *textbuf[]=
{
"This is the First line",
"This is the second line",
"This is the third line",
"This is the fourth line",
"This is the fifth line",
"This is the sixth line"
};

switch(iMessage) //处理消息
{
case WM_CREATE://处理窗口创建消息
hDC=GetDC(hWnd) ; //获取当前设备表句柄
GetTextMetrics(hDC,&tm); //获取字体信息
nXChar=tm.tmAveCharWidth; //获取字符宽度
nYChar=tm.tmHeight+tm.tmExternalLeading;
nCaps=(tm.tmPitchAndFamily&1?3:2)*nXChar/2;
ReleaseDC(hWnd,hDC); //释放当前设备句柄
return 0;
case WM_PAINT: //处理重画消息
hDC=BeginPaint(hWnd,&PtStr); //开始绘画
for(x=0;x<LnCount;x=x+1) //输出文本
TextOut(hDC,nXChar,nYChar*(1+x),textbuf[x],lstrlen(textbuf[x]));
EndPaint(hWnd,&PtStr);
return 0;
case WM_DESTROY: //结束应用程序
PostQuitMessage(0);
return 0;
default://其他消息处理程序
return(DefWindowProc(hWnd,iMessage,wParam,lParam)) ;
}
}
为什么呢,括号没有少啊

[解决办法]
楼主还是贴出来准确的错误信息好一些;单纯看代码根本看不出来毛病。
[解决办法]
建议给每个case加个{}试试

读书人网 >C语言

热点推荐