| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 544 人关注过本帖
标题:[求助] 本来可以编译的,现在出错了!
只看楼主 加入收藏
sunreal_7
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-2-7
收藏
 问题点数:0 回复次数:5 
[求助] 本来可以编译的,现在出错了!
Compiling...
winMain.cpp
d:\program files\microsoft visual studio\vc98\include\winuser.h(1889) : error C2059: syntax error : 'constant'
d:\program files\microsoft visual studio\vc98\include\winuser.h(1893) : error C2059: syntax error : ')'
f:\vc++源代码\lesson1\winmain\winmain.cpp(33) : error C2017: illegal escape sequence
f:\vc++源代码\lesson1\winmain\winmain.cpp(33) : error C2059: syntax error : ','
f:\vc++源代码\lesson1\winmain\winmain.cpp(39) : error C2143: syntax error : missing ')' before '{'
f:\vc++源代码\lesson1\winmain\winmain.cpp(39) : error C2143: syntax error : missing ';' before ')'
f:\vc++源代码\lesson1\winmain\winmain.cpp(39) : error C2143: syntax error : missing ';' before '{'
Error executing cl.exe.

昨天编译没有问题,今天什么都没有改,就出现了这么多的问题,怎么办啊??希望大家多帮忙。

QQ:285721286
搜索更多相关主题的帖子: 编译 
2007-02-08 12:02
福尔摩斯
Rank: 5Rank: 5
等 级:贵宾
威 望:12
帖 子:4011
专家分:370
注 册:2006-8-15
收藏
得分:0 

代码发上来


自我放逐。。。
2007-02-08 12:40
sunreal_7
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-2-7
收藏
得分:0 

#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 0;
wndcls.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndcls.hIcon = LoadIcon (NULL,IDI_ERROR);
wndcls.hCursor = LoadCursor (NULL,IDC_CROSS);
wndcls.hInstance = hInstance;
wndcls.lpfnWndProc = WinSunProc;
wndcls.lpszClassName = "wenxin";
wndcls.style = CS_HREDRAW | CS_VREDRAW;
wndcls.lpszMenuName = NULL;

RegisterClass(&wndcls); //注册窗口类

HWND hwnd;
hwnd = CreateWindow ("wenxin","sun", 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);
}//endof while
return 0;

} //endof winMain()

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf (szChar , "char is %d",wParam);
MessageBox(hwnd,szChar,"wenxin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","wenxin",0);
HDC hdc;
hdc = GetDC(hwnd);
TextOut (hdc,0,50,"景德镇陶瓷学院",strlen("景德镇陶瓷学院"));
ReleaseDC (hwnd,hdc);
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,"是否真的结束?","要退出第一个写的程序吗?",MB_YESNO))
{
DestroyWindow(hwnd);
}//ENDOF IF
break;
case WM_DESTROY:
PostQuitMessage(0);

break;
default:
return DefWindowProc(hwnd,uMsg, wParam, lParam);
}//endof swith()

return 0;
}//end of WinSunProc()

红色那里好象有错误。

2007-02-08 12:57
sunreal_7
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-2-7
收藏
得分:0 

#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 0;
wndcls.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndcls.hIcon = LoadIcon (NULL,IDI_ERROR);
wndcls.hCursor = LoadCursor (NULL,IDC_CROSS);
wndcls.hInstance = hInstance;
wndcls.lpfnWndProc = WinSunProc;
wndcls.lpszClassName = "wenxin";
wndcls.style = CS_HREDRAW | CS_VREDRAW;
wndcls.lpszMenuName = NULL;

RegisterClass(&wndcls); //注册窗口类

HWND hwnd;
hwnd = CreateWindow ("wenxin","景德镇陶瓷学院", 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);
}//endof while

return 0;

} //endof winMain()

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf (szChar , "char is %d",wParam);
MessageBox(hwnd,szChar,"wenxin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","wenxin",0);
HDC hdc;
hdc = GetDC(hwnd);
TextOut (hdc,0,50,"景德镇陶瓷学院",strlen("景德镇陶瓷学院"));
ReleaseDC (hwnd,hdc);
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,"是否真的结束?","要退出第一个写的程序吗?",MB_YESNO))
{
DestroyWindow(hwnd);
}//ENDOF IF
break;
case WM_DESTROY:
PostQuitMessage(0);

break;
default:
return DefWindowProc(hwnd,uMsg, wParam, lParam);
}//endof swith()

return 0;
}//end of WinSunProc()

2007-02-08 13:06
sunreal_7
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-2-7
收藏
得分:0 

#include <windows.h>
#include <stdio.h>

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASS wndcls;
wndcls.cbClsExtra = 0;
wndcls.cbWndExtra = 0;
wndcls.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndcls.hIcon = LoadIcon (NULL,IDI_ERROR);
wndcls.hCursor = LoadCursor (NULL,IDC_CROSS);
wndcls.hInstance = hInstance;
wndcls.lpfnWndProc = WinSunProc;
wndcls.lpszClassName = "wenxin";
wndcls.style = CS_HREDRAW | CS_VREDRAW;
wndcls.lpszMenuName = NULL;

RegisterClass(&wndcls); //注册窗口类

HWND hwnd;
hwnd = CreateWindow ("wenxin","景德镇陶瓷学院", 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);

}//endof while
return 0;

} //endof winMain()

LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf (szChar , "char is %d",wParam);
MessageBox(hwnd,szChar,"wenxin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"mouse clicked","wenxin",0);
HDC hdc;
hdc = GetDC(hwnd);
TextOut (hdc,0,50,"景德镇陶瓷学院",strlen("景德镇陶瓷学院"));
ReleaseDC (hwnd,hdc);
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,"是否真的结束?","要退出第一个写的程序吗?",MB_YESNO))
{
DestroyWindow(hwnd);
}//ENDOF IF
break;
case WM_DESTROY:
PostQuitMessage(0);

break;
default:
return DefWindowProc(hwnd,uMsg, wParam, lParam);
}//endof swith()

return 0;
}//end of WinSunProc()

2007-02-08 13:08
plusone
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-8-7
收藏
得分:0 
程序没有问题.

2007-02-08 17:23
快速回复:[求助] 本来可以编译的,现在出错了!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011605 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved