error C2504: base class undefined

后端 未结 3 1484
陌清茗
陌清茗 2021-01-17 16:16

I have encountered this error many times before and eventually found solutions, but this one has me stumped. I have a class \'Mob\' that is inherited by class \'Player\'.

3条回答
  •  伪装坚强ぢ
    2021-01-17 16:30

    Forward declaring doesn't help for class Player : public Mob because the compiler needs the full definition for inheritance.

    So most likely one of your includes in Mob.h is bringing in Player.h which then puts Player ahead of Mob and thus triggers the error.

提交回复
热议问题