extra qualification错误

今天在新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”的错误。

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

posted @ 2009-03-03 16:53  酱油和醋  阅读(8089)  评论(0编辑  收藏  举报