| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 277 人关注过本帖
标题:[讨论]一个程序为什么出现了这么多错误
只看楼主 加入收藏
风声边界
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-10-30
收藏
 问题点数:0 回复次数:0 
[讨论]一个程序为什么出现了这么多错误


#include <iostream.h>
#include <windows.h>
struct MyClass
{
public:
static int i;
};
//int MyClass::i;
void main()
{
struct MyClass cls1;
struct MyClass cls2;
cls1.i=1;
cout<<"cls1.i="<<cls1.i<<" cls2.i="<<cls2.i<<endl;
cls2.i=2;
cout<<"cls1.i="<<cls1.i<<" cls2.i="<<cls2.i<<endl;
}

C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(5) : error C2061: syntax error : identifier 'public'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(7) : error C2059: syntax error : '}'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(11) : error C2079: 'cls1' uses undefined struct 'MyClass'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(12) : error C2079: 'cls2' uses undefined struct 'MyClass'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(13) : error C2224: left of '.i' must have struct/union type
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(14) : error C2065: 'cout' : undeclared identifier
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(14) : error C2297: '<<' : illegal, right operand has type 'char [8]'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(14) : error C2224: left of '.i' must have struct/union type
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(14) : error C2224: left of '.i' must have struct/union type
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(14) : error C2065: 'endl' : undeclared identifier
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(15) : error C2224: left of '.i' must have struct/union type
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(16) : error C2297: '<<' : illegal, right operand has type 'char [8]'
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(16) : error C2224: left of '.i' must have struct/union type
C:\Documents and Settings\aaa\桌面\c1\eg1\eg2.c(16) : error C2224: left of '.i' must have struct/union type
Error executing cl.exe.

eg2.exe - 14 error(s), 0 warning(s)

搜索更多相关主题的帖子: 桌面 
2007-11-02 14:06
快速回复:[讨论]一个程序为什么出现了这么多错误
数据加载中...
 
   



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

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