battleutils.cpp:1037: error: explicit qualification in declaration of 'int32 battleutils::AbilityBenediction(CBattleEntity*, CBattleEntity*)'
What does this error mean exactly?
The first line here is 1037 (in battleutils.cpp):
int32 battleutils::AbilityBenediction(CBattleEntity* PCaster, CBattleEntity* PTarget)
{
....
return blah;
}
In the header file under:
namespace battleutils
{
is this:
int32 AbilityBenediction(CBattleEntity* PCaster, CBattleEntity* PTarget);
The .cpp file correctly includes the header file.
I ran into the same issue. I had some source that compiled using MS Visual Studio but using g++ in Linux it gave me:
... error: explicit qualification in declaration of '...
It appears that this error occurs when the implementation is already inside namespace foospace {...}
and the implementation gives the namespace again int foospace::barfunction(int blah){return 17;}
.
Basically, if the implementation (the code in you .cpp file) is already inside namespace foospace {...}
then remove foospace::
from the function definition.
Well, this is not an answer to this particular question, but because this is the first result on Google search when searching this error message, I just might tell that I got this error message when I had declared twice the namespace (when not needed) - like this
error: explicit qualification in declaration of ...
namespace foo {
// REMOVE THIS "foo::" from here
void foo::myFunction(int x) {
// ...
}
}
It's either missing, multiple times declared or wrong namespace.
Coming from other programming languages where namespace system is used a little bit differently, I can see why it is easy to get confused since C++'s classes need to have the classes name defined like this myClass::myMemberFunction(...)
Sorry if already mentioned above.
I landed here because I've switched from MSVC (Windows) to my Archlinux installation for testing cross-compile effectively.
So "Be Aware" that MSVC (Visual Studio) will be permissive using namespace extra qualifications - at least with the /W1 switch (level 1 warnings) thus ignoring the extra qualification (explicit namespace within itself). Notice that either in gcc; clang; msvc, this error does not happen to class members and function parameters and that is what confuses me about that extra qualification error only applied on "unit/file" functions...