As of now I have the below:

#ifndef RUNNER_H_
#define RUNNER_H_

#include "Maze.h"
#include <QtGui>

class Runner{
public:
	Runner(QColor c);
	int runnerSize;
	void setLocation(int,int);
	void setMaze(Maze);
	virtual void redraw(QPainter * painter) = 0;
	virtual ~Runner();

protected:
	int rXcoor;
	int rycoor;
	Maze * rMazePanel;
	QColor rColor;
private:


};

#endif /*RUNNER_H_*/
#ifndef MAZE_H_
#define MAZE_H_

#include "Player.h"
#include "Ghost.h"
#include <QtGui>

class Maze: public QWidget{
public:
	Maze(Player*,Ghost[],QWidget * parent = 0);
	int mWidth;
	int mHeight;
	int mWallDistance;
    int mBrickGap;
	int collideWall(int,int);

protected:
	 void paintEvent(QPaintEvent *event);
private:
	int mBrick[25][25];
	QColor mBackgroundColor;
	QColor mWallColor;
	Player * mPlayer;
	Ghost * mGhost;
};

#endif /* MAZE_H_ */

however when I compile this it doesn't recognize Maze as a type of class and I have no idea why
I would appreciate any kind of help

Recommended Answers

All 4 Replies

What sort of error message(s) do you get?

Did you check the spelling?

Did you check that your include guards are correct? If you re-use them in another file (say copy/paste without a complete edit), then you lose.

Are there any other maze.h files lying around, say in another directory?
Try

#ifndef MAZE_H_
#define MAZE_H_
#error Yep, included it OK

If you get to the #error, it will fail to compile.
But it will at least prove you're including that file.

Well I fixed the error, the problem was that there was a maze.o file in the same directory and I guess it was causing the compiler confusion

uhhmmm..... No, that shouldn't be the problem, since .o files are compiler produced.

oh wait sorry about that, now I know why i fixed the error

it was because I was including files in my header that I didn't really need. Apparently a header should only be included if a forward declaration is required. So by getting rid "maze.h" in my runner.h file solved this problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.