battleutils.cpp:1037:错误:'int32 battleutils :: AbilityBenediction(CBattleEntity*,CBattleEntity*)声明中的显式限定
这个错误究竟意味着什么?
这里的第一行是1037(在battleutils.cpp中):
int32 battleutils::AbilityBenediction(CBattleEntity* PCaster, CBattleEntity* PTarget)
{
....
return blah;
}
Run Code Online (Sandbox Code Playgroud)
在头文件下:
namespace battleutils
{
Run Code Online (Sandbox Code Playgroud)
这是:
int32 AbilityBenediction(CBattleEntity* PCaster, CBattleEntity* PTarget);
Run Code Online (Sandbox Code Playgroud)
.cpp文件正确包含头文件.
Ben*_*bot 24
我遇到了同样的问题.我有一些使用MS Visual Studio编译的源代码,但在Linux中使用g ++它给了我:
... error: explicit qualification in declaration of '...
Run Code Online (Sandbox Code Playgroud)
当实现已经在内部namespace foospace {...}并且实现再次给出命名空间时,似乎会发生此错误int foospace::barfunction(int blah){return 17;}.
基本上,如果实现(你.cpp文件中的代码)已经在里面,namespace foospace {...}那么foospace::从函数定义中删除.
O95*_*O95 10
好吧,这不是这个特定问题的答案,但是因为这是搜索此错误消息时谷歌搜索的第一个结果,我可能会告诉我,当我声明两次命名空间时(当不需要时)我收到此错误消息- 像这样
错误:声明中的明确资格......
namespace foo {
// REMOVE THIS "foo::" from here
void foo::myFunction(int x) {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
初学者的错误.检查您的命名空间.它要么丢失,要么多次声明或错误的命名空间 - 我会假设.