extra qualification错误(转)

本文介绍在使用新版本GCC 4.1.2编译C++程序时遇到的‘extraqualification’错误,原因在于类内方法前不应再写类名。解决方法只需删除多余资格。参考链接:[博客源](https://www.cnblogs.com/motadou/archive/2009/03/03/1558435.html)

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天在新SuSE机上编译cache的时候,出现了extra qualification这样的错误提示。该机器的GCC为4.1.2。浏览网上的资料,发现有关于该错误的如下描述:

With the new gcc version, most of C++ programs throw an error named extra qualification. Let's see how we can solve the error. What is the problem.

class Foo

{
    int Foo::Foo(void);
}

There's no need to type the class name before the methods. Code will be more clear.

class Foo
{
    int Foo(void);
}

也就是说在新版本的GCC中,不能像老版本GCC那样在类内的方法前加入类的名称,如int Foo::Foo(void)。如果这样做了新版本GCC就会抛出一个“extra qualification”的错误。

解决方法就是将方法前的类名去掉即可。

转自:https://www.cnblogs.com/motadou/archive/2009/03/03/1558435.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值