-
April 2nd, 2009, 11:50 AM
#1
gcc error: extra qualification
i got the following when trying to compile a header file:
Code:
cube512.h:12: error: extra qualification 'cube512::' on member 'cube512'
now i know this is default with gcc4.1 and up. my question is there a compiler switch to suppress this? thanks.
t.
-
April 2nd, 2009, 12:17 PM
#2
Re: gcc error: extra qualification
Show the smallest and simplest program that demonstrates the error.
-
April 2nd, 2009, 03:09 PM
#3
Re: gcc error: extra qualification
Code:
#ifndef BLOCK_H
#define BLOCK_H
class block{
public:
block::block(){
}
};
#endif
and...
Code:
#include<iostream>
#include"block.h"
using namespace std;
int main(){
block b = new block();
cout << b << endl;
}
-
April 2nd, 2009, 03:12 PM
#4
Re: gcc error: extra qualification
Both of them are simply errors. You should not qualify the member name in the member declaration, and new block() returns a block*, not a block. (You also forgot to use delete.)
-
April 2nd, 2009, 03:41 PM
#5
Re: gcc error: extra qualification
so there is no way around losing the "::"?
-
April 2nd, 2009, 05:04 PM
#6
Re: gcc error: extra qualification
Originally Posted by tzadik
so there is no way around losing the "::"?
C++ has language rules. Why are you trying to do something that's against the rules of the language? Fix the erroneous code, as laserlight has already pointed out.
Regards,
Paul McKenzie
-
April 3rd, 2009, 04:46 AM
#7
Re: gcc error: extra qualification
The problem is that gcc 3.x accepted this, and if you have legacy code, with gcc 4.x your problems begin. I had a similar problem lately. But I know of no flag to suppress this behaviour.
-
April 3rd, 2009, 04:56 AM
#8
Re: gcc error: extra qualification
Originally Posted by Richard.J
The problem is that gcc 3.x accepted this, and if you have legacy code, with gcc 4.x your problems begin.
That is why I try to compile with -Wall and -pedantic flags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|