C和C ++命名问题? [英] C and C++ naming issues?

查看:82
本文介绍了C和C ++命名问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.gubbe.ch/code /libcfgparse...8h-source.html


该页面包含一个标题,当包含时未定义任何

的typedef或该文件中的任何值引用。对于

实例,我包含了该文件,然后尝试了这个:


switch(file.get_type(" valid_operating_systems"))

{

case CFG_ITEM_NONE:cerr<< " NONE" << ENDL; break;

case CFG_ITEM_INTEGER:cerr<< " INT" << ENDL;休息;

案例CFG_ITEM_BOOLEAN:cerr<< " BOOL" << ENDL; break;

case CFG_ITEM_FLOATINGPOINT:cerr<< " FLOAT" << ENDL;中断;

案例CFG_ITEM_STRING:cerr<< " STR" << ENDL;中断;

案例CFG_ITEM_CONTAINER:cerr<< " CONTAINER" << ENDL;休息;

默认值:cerr<< 谁知道他妈的?! << endl;

}


使用g ++编译时,我收到一条错误消息,指出这些

标识符都不存在。但它们很明显地定义在

我包含的文件中!如果我将CfgItemType的定义复制到我的

源文件中,它编译就好了。我真的很想了解

如果有人能解决这个问题,那到底是怎么回事。


谢谢。

http://www.gubbe.ch/code/libcfgparse...8h-source.html

That page contains a header that when included does not define any of
the typedefs or any of the value references that are in that file. For
instance, I included that file and then tried this:

switch (file.get_type("valid_operating_systems"))
{
case CFG_ITEM_NONE: cerr << "NONE" << endl; break;
case CFG_ITEM_INTEGER: cerr << "INT" << endl; break;
case CFG_ITEM_BOOLEAN: cerr << "BOOL" << endl; break;
case CFG_ITEM_FLOATINGPOINT: cerr << "FLOAT" << endl; break;
case CFG_ITEM_STRING: cerr << "STR" << endl; break;
case CFG_ITEM_CONTAINER: cerr << "CONTAINER" << endl; break;
default: cerr << "WHO THE FUCK KNOWS?!" << endl;
}

When compiled with g++ I get an error saying that none of those
identifiers exist. But they are quite obviously defined right there in
the file I included! If I copy the definition for CfgItemType into my
source file it compiles just fine. I would really like to understand
what the hell is going on here if anyone can figure that out.

Thanks.

推荐答案

Noah Roberts写道:
Noah Roberts wrote:
http://www.gubbe.ch/code/libcfgparse...8h-source.html

该页面包含一个标题,当包含时不会定义任何typedef或该文件中的任何值引用。对于
实例,我包含了该文件然后尝试了这个:

switch(file.get_type(" valid_operating_systems"))
{
案例CFG_ITEM_NONE:cerr< ;< " NONE" << ENDL;破坏;
案例CFG_ITEM_INTEGER:cerr<< " INT" << ENDL;破坏;
案例CFG_ITEM_BOOLEAN:cerr<< " BOOL" << ENDL;破坏;
案例CFG_ITEM_FLOATINGPOINT:cerr<< " FLOAT" << ENDL;破坏;
案例CFG_ITEM_STRING:cerr<< " STR" << ENDL;破坏;
案例CFG_ITEM_CONTAINER:cerr<< " CONTAINER" << ENDL; break;
默认值:cerr<< 谁知道他妈的?! <<当使用g ++编译时,我得到一个错误,指出这些
标识符都不存在。但它们在我所包含的文件中非常明确地定义了!如果我将CfgItemType的定义复制到我的
源文件中,它编译就好了。我真的很想了解
如果有人能解决这个问题,那么到底发生了什么。
http://www.gubbe.ch/code/libcfgparse...8h-source.html

That page contains a header that when included does not define any of
the typedefs or any of the value references that are in that file. For
instance, I included that file and then tried this:

switch (file.get_type("valid_operating_systems"))
{
case CFG_ITEM_NONE: cerr << "NONE" << endl; break;
case CFG_ITEM_INTEGER: cerr << "INT" << endl; break;
case CFG_ITEM_BOOLEAN: cerr << "BOOL" << endl; break;
case CFG_ITEM_FLOATINGPOINT: cerr << "FLOAT" << endl; break;
case CFG_ITEM_STRING: cerr << "STR" << endl; break;
case CFG_ITEM_CONTAINER: cerr << "CONTAINER" << endl; break;
default: cerr << "WHO THE FUCK KNOWS?!" << endl;
}

When compiled with g++ I get an error saying that none of those
identifiers exist. But they are quite obviously defined right there in
the file I included! If I copy the definition for CfgItemType into my
source file it compiles just fine. I would really like to understand
what the hell is going on here if anyone can figure that out.




我相信答案在FAQ 5.8中。按照以下

链接查找常见问题解答: http ://www.parashift.com/c++-faq-lite/

V



I believe the answer is in the FAQ 5.8. Find the FAQ by following this
link: http://www.parashift.com/c++-faq-lite/

V



Victor Bazarov写道:

Victor Bazarov wrote:
我相信答案在FAQ 5.8中。按照
链接查找常见问题解答: http:// www .parashift.com / c ++ - faq-lite /
I believe the answer is in the FAQ 5.8. Find the FAQ by following this link: http://www.parashift.com/c++-faq-lite/




我不这么认为,聪明人。



I don''t think so, smartass.


我已经知道发生了什么。无论如何,谢谢。

I have figured out what is going on. Thanks anyway.


这篇关于C和C ++命名问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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