Extra Qualification Error in C++

extra qualification error in C++

This is because you have the following code:

class JSONDeserializer
{
Value JSONDeserializer::ParseValue(TDR type, const json_string& valueString);
};

This is not valid C++ but Visual Studio seems to accept it. You need to change it to the following code to be able to compile it with a standard compliant compiler (gcc is more compliant to the standard on this point).

class JSONDeserializer
{
Value ParseValue(TDR type, const json_string& valueString);
};

The error come from the fact that JSONDeserializer::ParseValue is a qualified name (a name with a namespace qualification), and such a name is forbidden as a method name in a class.

Having problems with an extra qualification error in c++11 compiler

You have this line in your class:

 void print(){

I believe you meant

 void print();

Because of the way C++ compiles, when you say #include "order.h" the compiler is literally copy and pasting the contents of order.h into your cpp file. So it sees that you have opened this function definition for print, and declared some local functions inside of your member function print (a gcc extension), and then you eventually close the function out at the line labeled };//class Order. This looks to you like the end of the class definition, but it's actually the end of your function. The function definitions later on that are in your cpp file are seen as being inside the class body, which confuses the compiler.

extra qualification errors. How warranted by the Standard?

A qualified name in C++ always must refer to a previously declared name. This is specified in clause 8.3 and 3.4.3.2.

You cannot firstly declare a variable or member by using a qualified name - it will end up in a "cannot resolve identifier"-liky compiler error. Such qualifiers are designed to be used for redeclaration. Hence the requirement that these names must find previously declared entities.

extra qualification member GCC

The errors imply that the compiler thinks those definitions are found lexically within the class definition, which implies a missing }; or somesuch.

That's all I can say from the information provided.



Related Topics



Leave a reply



Submit