According to VS, I'm <<mising ";" before "*">>...
May 4, 2011 at 1:58pm
Hi everybody. I'm staring into my screen for a while and can't figure out what's wrong. Could you help me?
Here's the code of Truck.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
//DONE
#ifndef TRUCK_H
#define TRUCK_H
#include "Firefighter.h"
#include "Accident.h"
class Accident;
class Firebrigade;
class Frefighter;
class Truck
{
private:
Firefighter *onboard_firefighters[6]; //THE ERROR OCCURS HERE
Firebrigade* which_firebrigade;
Accident* which_accident;
unsigned id;
string model;
unsigned year_of_production;
bool on_mission;
friend class Firebrigade;
friend Firefighter::~Firefighter();
friend class Accident;
public:
bool get_on_mission() const;
void display_info() const;
unsigned int get_id() const;
Truck(unsigned id, string model, unsigned year);
~Truck();
};
#endif
|
Here's the error:
Error 1 error C2143: syntax error : missing ';' before '*' c:\users\pawel\desktop\c++ project\fire brigade\fire brigade\truck.h 16
Any ideas?
If needed, my Firefighter.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
//DONE
#ifndef FIREFIGHTER_H
#define FIREFIGHTER_H
#include <string>
#include "Firebrigade.h"
using namespace std;
class Firebrigade;
class Truck;
class Firefighter
{
public:
enum rank_type
{
firefighter,
sergeant,
lieutenant,
captain,
battalion_chief,
division_chief,
assistant_chief,
chief
};
private:
Firebrigade* which_firebrigade; //Describes to which unit the firefighter belongs.
Truck* which_truck;
unsigned id; //unique ID
string name;
rank_type what_rank;
bool on_mission; //Whether the firefighter is currently on a mission or not.
friend class Firebrigade; //Dlaczego nie działa friend tylko dla funkcji hire_firefighter, fire_firefighter?
friend class Truck;
friend class Accident;
public:
void display_info(); //DONE
void promote(); //DONE
unsigned int get_id() const; //DONE
Firefighter(unsigned id, string name, rank_type what_rank); //DONE
~Firefighter(); //DONE
};
#endif
|
May 4, 2011 at 2:05pm
Line 11 has Firefighter spelt wrong. It is missing an "i".
May 4, 2011 at 4:28pm
He's including "firefighter.h" though so that shouldn't matter (the forward declaration is redundant)
My first thought was that the Accident class was missing a semicolon at the end of it.
Double check Accident.h and make sure you put a ; after the class.
May 4, 2011 at 9:07pm
It was indeed the spelling problem. :)
Last edited on May 5, 2011 at 10:19am
Topic archived. No new replies allowed.