标题:[求助]程序错误提示不懂
取消只看楼主
taijixing
Rank: 1
等 级:新手上路
威 望:1
帖 子:118
专家分:0
注 册:2007-6-9
 问题点数:0 回复次数:1 
[求助]程序错误提示不懂

#include <iostream>
static int n=0;
class CType
{
public:
CType()
{
m_n=n++;
int m_n;
}
};

CType d;
void fs()
{
static CType s;
cout<<"s."<<s.m_n<<endl;
}

void fa()
{
CType a;
cout<<"a."<<a.m_n<<endl;
}

void main()
{
fs();
fs();
fa();
fa();
}


--------------------Configuration: diaoyong2 - Win32 Debug--------------------
Compiling...
diaoyong2.cpp
e:\vc++\add\diaoyong2\diaoyong2.cpp(8) : error C2065: 'm_n' : undeclared identifier
e:\vc++\add\diaoyong2\diaoyong2.cpp(17) : error C2065: 'cout' : undeclared identifier
e:\vc++\add\diaoyong2\diaoyong2.cpp(17) : error C2297: '<<' : illegal, right operand has type 'char [3]'
e:\vc++\add\diaoyong2\diaoyong2.cpp(17) : error C2039: 'm_n' : is not a member of 'CType'
e:\vc++\add\diaoyong2\diaoyong2.cpp(4) : see declaration of 'CType'
e:\vc++\add\diaoyong2\diaoyong2.cpp(17) : error C2065: 'endl' : undeclared identifier
e:\vc++\add\diaoyong2\diaoyong2.cpp(23) : error C2297: '<<' : illegal, right operand has type 'char [3]'
e:\vc++\add\diaoyong2\diaoyong2.cpp(23) : error C2039: 'm_n' : is not a member of 'CType'
e:\vc++\add\diaoyong2\diaoyong2.cpp(4) : see declaration of 'CType'
执行 cl.exe 时出错.

diaoyong2.exe - 1 error(s), 0 warning(s)

搜索更多相关主题的帖子: 程序错误 提示 
2007-07-26 23:36
taijixing
Rank: 1
等 级:新手上路
威 望:1
帖 子:118
专家分:0
注 册:2007-6-9
得分:0 
多谢楼上大哥
2007-07-27 13:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-158424-1-1.html




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

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