I am writing a pac man game to practice using the Windows API. I recently added pathfinding using an A* algorithm. To do this I used a class shown below:
This class has been used in a test program for the pathfinding with no problems. As soon as I came to include it in the main pac man project I started getting all sorts of hassle. First of all I had to put () around the class name to get it to compile, but after that I get the following error
pathsquare.h(12) : error C2143: syntax error : missing ';' before 'type'
for each of the class attributes and methods. What is going on? I feel like I am missing something stupid here (my own fault for using Java so much recently!)
I am not even making use of the class in the main project yet, just trying to get the old project (which is a simple,working version of the pac man game which has been running for a month or so) to compile with the new class included i.e. the only new lines of code are include "PathSquare.h" and the .h file and the .cpp file have been added to the workspace.
Any help would be much appreciated and may prevent another computer being battered with a seven iron.
Code:
//////////////////////////////////////////////////////////////////////////////
// Class : PathSquare
//
// PathSquare objects are used in the path finding A* algorithm to identify
// a potential square on a path and the G and H values associated with the
// square.
//////////////////////////////////////////////////////////////////////////////
class PathSquare
{
private:
int herex;
int herey;
int parentx;
int parenty;
int G;
int H;
public:
PathSquare();
PathSquare(int hx,int hy,int px, int py, int gval,
int hval);
void SetHere(int hx,int hy);
void SetParent(int px,int py);
void SetG(int g);
void SetH(int h);
int GetHerex();
int GetParentx();
int GetHerey();
int GetParenty();
int GetG();
int GetH();
int GetF();
void operator = (const PathSquare&);
};
This class has been used in a test program for the pathfinding with no problems. As soon as I came to include it in the main pac man project I started getting all sorts of hassle. First of all I had to put () around the class name to get it to compile, but after that I get the following error
pathsquare.h(12) : error C2143: syntax error : missing ';' before 'type'
for each of the class attributes and methods. What is going on? I feel like I am missing something stupid here (my own fault for using Java so much recently!)
I am not even making use of the class in the main project yet, just trying to get the old project (which is a simple,working version of the pac man game which has been running for a month or so) to compile with the new class included i.e. the only new lines of code are include "PathSquare.h" and the .h file and the .cpp file have been added to the workspace.
Any help would be much appreciated and may prevent another computer being battered with a seven iron.