Hi everyone. I'm fighting with this thing since yesterday and can't get any idea what's wrong. Here's the code of my Headquarters.h:
The errors:Code:#ifndef HEADQUARTERS_H #define HEADQUARTERS_H #include "node.h" #include "Main_trucks_list.h" //Isn't it defined here? #include "Main_firefighters_list.h" //And here? #include <string> using namespace std; class Firebrigade; class Accident; class Main_trucks_list; class Main_firefighters_list; class Headquarters { private: Main_trucks_list my_main_trucks_list; //ERROR HERE Main_firefighters_list my_main_firefighters_list; //ERROR HERE node<Accident>* accident_head; node<Firebrigade>* firebrigade_head; string town; string street; friend class Accident; friend class Firebrigade; friend class Firefighter; friend class Truck; public: node<Firebrigade>* get_firebrigade_head() const; bool insert_firebrigade(Firebrigade*); bool delete_firebrigade(string address); bool create_accident(string place, unsigned how_many_firefighters); unsigned count_accidents() const; bool remove_accident(unsigned id); void display_accidents() const; Headquarters(string town, string street); ~Headquarters(); }; #endif
Code:Error 1 error C2079: 'Headquarters::my_main_trucks_list' uses undefined class 'Main_trucks_list' c:\users\pawel\desktop\c++ project\fire brigade\fire brigade\headquarters.h 20
I can't understand why I get that. In lines 12 and 13 I declared the classes which are defined in their headerfiles. What's the problem?Code:Error 2 error C2079: 'Headquarters::my_main_firefighters_list' uses undefined class 'Main_firefighters_list' c:\users\pawel\desktop\c++ project\fire brigade\fire brigade\headquarters.h 21
Additional:
Main_trucks_list.h:
Main_firefighters_list.h:Code:#pragma once #include "Truck.h" class Truck; class Main_trucks_list { private: node<Truck>* head; public: bool insert_truck(Truck*); bool remove_truck(unsigned id); Main_trucks_list(void); ~Main_trucks_list(void); Truck* find(unsigned id) const; };
Please, help me, I'm going crazy...Code:#pragma once #include "Firefighter.h" class Firefighter; class Main_firefighters_list { private: node<Firefighter>* head; public: bool insert_firefighter(Firefighter*); bool remove_firefighter(unsigned id); Main_firefighters_list(void); ~Main_firefighters_list(void); Firefighter* find(unsigned id) const; };




Reply With Quote