明确的申报资格 [英] explicit qualification in declaration

查看:187
本文介绍了明确的申报资格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


battleutils.cpp:1037:错误:显式限定'int32 battleutils :: AbilityBenediction(CBattleEntity *,CBattleEntity *)'的声明''

这个错误是什么意思?



这里的第一行是1037(在battleutils.cpp中):

  int32 battleutils :: AbilityBenediction(CBattleEntity * PCaster,CBattleEntity * PTarget)
{
....
返回等等;

的头文件中:

  namespace battleutils 
{

是这样的:

  int32 AbilityBenediction(CBattleEntity * PCaster,CBattleEntity * PTarget); 

.cpp文件正确包含头文件。

解决方案

你不能声明(也不能定义)属于命名空间之外的命名空间的实体。这样做:

  namespace foo {void bar(){}} 
pre>

not this:

  void foo :: bar() {} //不合法

编辑上面是错误的,您可以在其名称空间之外定义一个实体,如果在名称空间内已经看到它的声明。这个错误必定有其他原因。


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.

解决方案

You cannot declare (nor define) entities that belong to a namespace outside of their namespace. Do this:

 namespace foo { void bar() {} }

not this:

 void foo::bar() {} // not legal

EDIT The above is wrong, you can define an entity outside of its namespace, provided its declaration inside the namespace has been seen. There must be some other reason for this error.

这篇关于明确的申报资格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆