error: expected class-name before '{'

Hi,

we have a problem!
The compiler says:
error: expected class-name before '{' token
even though we use #include "AbstractAirplane.h"
Whats wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef PASSENGERVESSEL_H_
#define PASSENGERVESSEL_H_

#include <string>

#include "AbstractAirplane.h"

using namespace std;

class PassengerVessel : public AbstractAirplane {

private:
	void handleLandingRequest();
	void handleOffloadRequest();

public:
	PassengerVessel(int i, std::string n, int a);

	void action();

};

#endif 
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
#ifndef ABSTRACTAIRPLANE_H_
#define ABSTRACTAIRPLANE_H_

#include "State.cpp"

#include "SimulationEngine.h"

#include <string>

using namespace std;

class AbstractAirplane {

	protected:
		int id;
		std::string name;
		int actionTime;
		State state;

		SimulationEngine* e;

	public:
		/* Params:
		 * int i = The ID for the Airplane.
		 * string n = The name of the Airplane.
		 * int a = The actionTime
		 */
		AbstractAirplane(int i, std::string n, int a);
		virtual ~AbstractAirplane();

		void setId(int val);
		void setName(std::string val);
		void setActionTime(int val);
		void setState(State val);

		int getId() const;
		std::string getName() const;
		int getActionTime() const;
		State getState() const;

		virtual void action() = 0;

};

#endif 
Check for circular #includes. Does SimulationEngine.h include PassengerVessel.h either directly or indirectly?

Topic archived. No new replies allowed.