views:

3071

answers:

5

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. )

+3  A: 

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

Logan Capaldo
When I comment out that field it starts complaining about the next line
Calmarius
+2  A: 

Is "Status" a macro or otherwise declared/defined in one of the headers (or whatever they include)?

Michael Burr
+1  A: 

The file you have shown us is a header file. The problem you're having is on the 16th line of some source file which is #includeing that header. Can you copy+paste the exact error message you're receiving, as well as the relevant portion of the file referenced in the error message?

Adam Rosenfield
Some warning before (which are unrelated to this) and some another errors that are related to this error (no additional information of course and all of them point to this line)
Calmarius
I repeat: please copy+paste the EXACT error messages you're receiving, and include the warnings which you think are unrelated -- they could very well be related. The first error/warning you receive almost always is the most relevant.
Adam Rosenfield
+1  A: 

There is a semi-colon missing in the last previous class declaration, not the one it's complaining about. The error is probably in "timer.h", but maybe in "player.h"

UncleO
both classes has their semicolons at the end of their declarations.
Calmarius
+1  A: 

I'm a fool...

Code::Blocks sometimes doesn't save the source file before start compiling the file. MSVC++ always save it before compile. That was the real problem.

it seems there was a Status macro somewhere in the code. But it wasn't my own type. Probably a macro from a wxwidgets header...

Calmarius