“关闭”是C ++中的保留字吗? [英] Is 'close' a reserved word in C++ ?

查看:104
本文介绍了“关闭”是C ++中的保留字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码无法编译:


#include< iostream>


class close {

public:

void message();

};


inline void close :: message()

{

std :: cout<< Close class\\\
;

}


int main()

{

关闭c;


c.message();

}


g ++给出的消息是:


other.cc:在函数`int main()'':

other.cc:15:错误:'close''未声明(首次使用)这个函数)

other.cc:15:错误:(每个未声明的标识符只报告它出现的每个

函数一次。)

other.cc:15:错误:`之前的语法错误''''令牌

other.cc:17:错误:`c''未声明(首先使用此功能)


我不明白。我已经找到了C ++中保留字的列表和

''close''不存在。


-

Roman Werpachowski

/ -------- ============== -------- \

| http://www.cft.edu.pl/~roman |

\ -------- ============== -------- /

The following code does not compile:

#include <iostream>

class close {
public:
void message();
};

inline void close::message()
{
std::cout << "Close class\n";
}

int main()
{
close c;

c.message();
}

The message given by g++ is:

other.cc: In function `int main()'':
other.cc:15: error: `close'' undeclared (first use this function)
other.cc:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
other.cc:15: error: syntax error before `;'' token
other.cc:17: error: `c'' undeclared (first use this function)

I don''t understand it. I''ve looked for a list of reserved words in C++ and
''close'' is not there.

--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/

推荐答案



Roman Werpachowski写道:

Roman Werpachowski wrote:
以下代码无法编译:

#include< ; iostream>

课程关闭{
公开:
void message();
};

inline void close :: message( )
{
std :: cout<< 关闭班级\ n;;
}
int main()
{
关闭c;

c.message( );


g ++给出的消息是:

other.cc:在函数`int main()'':
其他。 cc:15:错误:'关闭''未声明(首先使用此功能)
other.cc:15:错误:(每个未声明的标识符仅针对它出现的每个
函数报告一次。)
other.cc:15:错误:`之前的语法错误''''令牌
other.cc:17:错误:`c''未声明(首先使用此功能)

我不明白。我在C ++中找了一个保留字列表,而
''close''不存在。
The following code does not compile:

#include <iostream>

class close {
public:
void message();
};

inline void close::message()
{
std::cout << "Close class\n";
}

int main()
{
close c;

c.message();
}

The message given by g++ is:

other.cc: In function `int main()'':
other.cc:15: error: `close'' undeclared (first use this function)
other.cc:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
other.cc:15: error: syntax error before `;'' token
other.cc:17: error: `c'' undeclared (first use this function)

I don''t understand it. I''ve looked for a list of reserved words in C++ and
''close'' is not there.




close不是保留字C ++。 Comeau编译你的程序

罚款。您使用的是什么版本的gcc?


致敬,

Tom



close is not a reserved word in C++. Comeau compiles your program
fine. What version of gcc are you using?

Best regards,

Tom


在2005年12月28日17:04:18 -0800,Thomas Tutone写道:
On the 28 Dec 2005 17:04:18 -0800, Thomas Tutone wrote:
我不明白。我已经找到了C ++中保留字的列表,而
''close''不存在。
I don''t understand it. I''ve looked for a list of reserved words in C++ and
''close'' is not there.



close不是C ++中的保留字。 Comeau编译你的程序
很好。您使用的是什么版本的gcc?



close is not a reserved word in C++. Comeau compiles your program
fine. What version of gcc are you using?




3.3.6编译为x86_64

-

Roman Werpachowski

/ -------- ============== -------- \

| http://www.cft.edu.pl/~roman |

\ -------- ============== -------- /



3.3.6 compiled for x86_64
--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/


在星期四,2005年12月29日01:08:16 +0000(UTC),Roman Werpachowski写道:
On the Thu, 29 Dec 2005 01:08:16 +0000 (UTC), Roman Werpachowski wrote:
2005年12月28日17:04:18 -0800,托马斯Tutone写道:
On the 28 Dec 2005 17:04:18 -0800, Thomas Tutone wrote:
我不明白。我已经找到了C ++中保留字的列表,而
''close''不存在。
I don''t understand it. I''ve looked for a list of reserved words in C++ and
''close'' is not there.



close不是C ++中的保留字。 Comeau编译你的程序
很好。您使用的是哪个版本的gcc?



close is not a reserved word in C++. Comeau compiles your program
fine. What version of gcc are you using?



3.3.6为x86_64编译



3.3.6 compiled for x86_64




当我删除


#include< iostream>


line。


-

Roman Werpachowski

/ -------- ============== -------- \

| http://www.cft.edu.pl/~roman |

\ -------- ============== -------- /



The darn thing compiles when I remove

#include <iostream>

line.

--
Roman Werpachowski
/--------==============--------\
| http://www.cft.edu.pl/~roman |
\--------==============--------/


这篇关于“关闭”是C ++中的保留字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆