“一种声明中的多种类型”但不是 ;失踪 [英] "multiple types in one declaration" but no ; missing

查看:193
本文介绍了“一种声明中的多种类型”但不是 ;失踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用Code :: Blocks(gcc编译器)编译我的程序。我得到一个错误:这是它抱怨的源文件:

  #ifndef BOT_H 
#define BOT_H

#includeplayer.h
#includetimer.h

class BOTS; // BOTS转发decalration

类BOT:public PLAYER
{
public:
enum BotStatus {BotMoving,BotPursue,BotChasePowerup};
enum BotMovDir {上,下,左,右,前进,后退};
enum BotSkill {简单,普通,困难,专家,疯狂};
保护:
BotStatus状态; //这是抱怨
的行; BotMovDir CurrentMov;
TIMER CTimer;
bool Stucked;
BotSkill技能;
VECTOR3D AimTarget;
// VECTOR3D ShotTarget;
PLAYER * PursueObj;
bool SameLevel;
BOTS *所有者;
bool PlayerHitMe;
void OnDamage(double dmg,const wchar_t * Shooter,bool s);
void OnReset();
public:
BOT(BOTS * o,const wchar_t * botname):PLAYER(botname),PlayerHitMe(false),Status(BotMoving),Skill(Easy),Owner(o)
{
PlayerInit();
}
void SetSkill(BotSkill bs){Skill = bs;}
void BotControl();
void SetSameLevel(bool s){SameLevel = s;}
virtual〜BOT(){}
};

#endif

它抱怨第16行宣言,这让我疯狂。我搜索了很多,但常见的解决方案是找到缺少的分号。问题是根本没有丢失分号。它总是指向第16行(至少在受保护之后),即使有评论,甚至超出了eof(当我删除所有字段以使文件变小时)。



(这个问题可能微不足道,现在我可能已经很累了,所以我必须睡一觉,而且我希望明天早上有人会给我一些建议。)

Status 的类或其他一些UDT吗?如果您将会员的姓名更改为 Status_


I tried to compile my program, with Code::Blocks (gcc compiler). And I get an error: Here is the source file it complaining about:

#ifndef BOT_H
#define BOT_H

#include "player.h"
#include "timer.h"

class BOTS; // forward decalaration of BOTS

class BOT : public PLAYER
{
public:
    enum BotStatus{BotMoving,BotPursue,BotChasePowerup};
    enum BotMovDir{Up,Down,Left,Right,Forward,Backward};
    enum BotSkill{Easy,Normal,Hard,Expert,Insane};
protected:
    BotStatus Status;  // this is the line it complaining about
    BotMovDir CurrentMov;
    TIMER CTimer;
    bool Stucked;
    BotSkill Skill;
    VECTOR3D AimTarget;
//  VECTOR3D ShotTarget;
    PLAYER *PursueObj;
    bool SameLevel;
    BOTS *Owner;
    bool PlayerHitMe;
    void OnDamage(double dmg,const wchar_t *Shooter,bool s);
    void OnReset();
public:
    BOT(BOTS *o,const wchar_t *botname) : PLAYER(botname), PlayerHitMe(false), Status(BotMoving), Skill(Easy), Owner(o)
    {
        PlayerInit();
    }
    void SetSkill(BotSkill bs) {Skill=bs;}
    void BotControl();
    void SetSameLevel(bool s) {SameLevel=s;}
    virtual ~BOT() {}
};

#endif

It complains about the 16th line "multiple types in one declaration" and it is driving me crazy. I googled a lot, but the common solution is "find the missing semicolon". And the problem is that there is no missing semicolon at all. It always point to the 16th line (at least after the protected) even if there is a comment or even it is beyond the eof (when I remove all fields so the file become small).

(This problem might be trivial and I may be tired now, so I must have a sleep. And I hope someone will have given me some advice by morning tomorrow. )

解决方案

Do you have a class or some other UDT named Status? What if you change the name of the member to Status_ ?

这篇关于“一种声明中的多种类型”但不是 ;失踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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