   really need help compiling
  I've got some problem with my headers linking together properly and compiling in the correct order.  My compiler keeps informing me that classes are undeclared, and it essentially creates an error every time I attempt to use an object of the class.I'm just going to attach the program, hopefully someone will be generous enough to help me figure out what's going wrong.  There really aren't too many lines... it's just separated into a bunch of different files.The main problem is that the program is considering both the Ball and Point classes undeclared... so every time I use or create a Ball or Point type, I receive an error.I excluded main because it's sort of irrelevant until I get all these classes sorted out.Thank you very much if you're willing to take the time to help me.The order of files goes as follows:Point.hPoint.cppBall.hBall.cppVelocity.hVelocity.cppPlayerBall.hPlayerBall.cppConstants.h[source lang=cpp]//Point.h//#pragma once#include <vector>#include "PlayerBall.h"class Ball;  //placed in the Point.h file here to account for cyclical dependency//No definition included////Point.h//class Point { public:   Point (int x =0, int y = 0);   ~Point (); //accessor methods inline int Distance (Ball Ball_1, Ball Ball_2); //player Ball and other Ball can collide and two other Balls can collide inline int Distance (Ball Ball_1, PlayerBall Ball_2);   void SetX ( int x ) { itsX = x; }   void SetY ( int y ) { itsY = y; }   int GetX() const { return itsX; }   int GetY() const { return itsY; }    private:    int itsX;    int itsY;};//Point.cpp//#include "Point.h"#include "Ball.h" //cyclical dependency accounted for#include "PlayerBall.h"#include <vector>#include <math.h>Point::Point (int x, int y) //deault x and y set to 0{itsX = x;itsY = y;}Point::~Point(void){}//use the pythagorean theorum to determine the distance between two points.//used to determine whether or not two Balls have collidedinline int Point::Distance (Ball Ball_1, Ball Ball_2){    return sqrt( ((Ball_2.itsPosition.GetX() - Ball_1.itsPosition.GetX()) * (Ball_2.itsPosition.GetX() - Ball_1.itsPosition.GetX())) + ((Ball_2.itsPosition.GetY() - Ball_1.itsPosition.GetY()) * (Ball_2.itsPosition.GetY() - Ball_1.itsPosition.GetY())) );}inline int Point::Distance(Ball Ball_1, PlayerBall Ball_2) //the class is PlayerBall{return sqrt( ((Ball_2.itsPosition.GetX() - Ball_1.itsPosition.GetX()) * (Ball_2.itsPosition.GetX() - Ball_1.itsPosition.GetX())) + ((Ball_2.itsPosition.GetY() - Ball_1.itsPosition.GetY()) * (Ball_2.itsPosition.GetY() - Ball_1.itsPosition.GetY())) );}//Ball.h//#pragma once#include "Point.h" //because Ball is a composition#include "Velocity.h"#include <vector>class Point;class Ball { public:  Ball(int, int);  ~Ball();  void WallCollision ();   void ApplyForce ();  //accessor methods  void SetExistence (bool truth) { itsExistence = truth; }  int GetExistence () const { return itsExistence; } private:  Point itsPosition;  Velocity itsVelocity;  bool itsExistence;};//Ball.cpp//#include <vector>#include "Ball.h"#include "point.h"#include "Constants.h"void Ball::WallCollision() //tests to see if a ball crashes into a wall and changes velocity if true{if (itsPosition.GetX + 5 == RIGHT ) { itsVelocity.SetX ( - itsPosition.GetX ); }if (itsPosition.GetX - 5 == LEFT  ) { itsVelocity.SetX ( - itsPosition.GetX ); }if (itsPosition.GetY + 5 == TOP   ) { itsVelocity.SetY ( - itsPosition.GetY ); }if (itsPosition.GetY - 5 == BOTTOM) { itsVelocity.SetY ( - itsPosition.GetY ); }}Ball::Ball (int x, int y){itsPosition.SetX ( x );    itsPosition.SetY ( y );}Ball::~Ball(){}//Velcoity.h//#pragma onceclass Velocity{public:Velocity(int x = 0, int y = 0);~Velocity();   //accessor methods    void SetX ( int x ) { itsX = x; }    void SetY ( int y ) { itsY = y; }    int GetX() const { return itsX; }    int GetY() const { return itsY; }private:    int itsX;    int itsY;};//Velocity.cpp//#include "Velocity.h"Velocity::Velocity(int x, int y){itsX = x;itsY = y;}Velocity::~Velocity(void){}//PlayerBall.h//#pragma once#include "Ball.h"class PlayerBall : public Ball{public:PlayerBall();~PlayerBall();   //get input from the mouse using SDL functions    private:    //add any needed variables for SDL functions to execute.};//PlayerBall.cpp//#include "PlayerBall.h"PlayerBall::PlayerBall(){}PlayerBall::~PlayerBall(){}///Constants.h//////Constants that define the boundaries of the window///These are used in the Ball class and are essentially considered points.///the addition of the absolute value of these ranges equals the size of the windowsconst int LEFT = 0;const int RIGHT = 640;const int TOP = 0;const int BOTTOM = 480;//constants that define the window size in SDLconst int SCREEN_WIDTH = 640;const int SCREEN_HEIGHT = 480;const int SCREEN_BPP = 32;EDIT: error messages included... I'm not really sure how to include all of the lines because they aren't exactly listed... It does tell you files and functions, though, and since the files are too big and are named, it shouldn't be terribly difficult to navigate.///////////A LOT of error messages//////////////I think they are mostly all caused by the same thing, however.1>Ball.cpp1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\playerball.h(5) : error C2504: 'Ball' : base class undefined1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(10) : error C3867: 'Point::GetX': function call missing argument list; use '&Point::GetX' to create a pointer to member1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(10) : error C2296: '+' : illegal, left operand has type 'int (__thiscall Point::* )(void) const'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(10) : error C2276: '-' : illegal operation on bound member function expression1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(11) : error C3867: 'Point::GetX': function call missing argument list; use '&Point::GetX' to create a pointer to member1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(11) : error C2296: '-' : illegal, left operand has type 'int (__thiscall Point::* )(void) const'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(11) : error C2276: '-' : illegal operation on bound member function expression1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(12) : error C3867: 'Point::GetY': function call missing argument list; use '&Point::GetY' to create a pointer to member1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(12) : error C2296: '+' : illegal, left operand has type 'int (__thiscall Point::* )(void) const'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(12) : error C2276: '-' : illegal operation on bound member function expression1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(13) : error C3867: 'Point::GetY': function call missing argument list; use '&Point::GetY' to create a pointer to member1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(13) : error C2296: '-' : illegal, left operand has type 'int (__thiscall Point::* )(void) const'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(13) : error C2276: '-' : illegal operation on bound member function expression1>PlayerBall.cpp1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.h(18) : error C2061: syntax error : identifier 'PlayerBall'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\playerball.cpp(4) : error C2512: 'Ball' : no appropriate default constructor available1>Point.cpp1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : error C2079: 'Ball::itsPosition' uses undefined class 'Point'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(21) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetX' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2248: 'Ball::itsPosition' : cannot access private member declared in class 'Ball'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(24) : see declaration of 'Ball::itsPosition'1>   c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.h(11) : see declaration of 'Ball'1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\point.cpp(26) : error C2228: left of '.GetY' must have class/struct/union1>   type is 'int'[Edited by - zoner7 on June 18, 2009 8:52:32 PM]
  Post exact error messages include what lines they occur on.   ;  Everything stems from the first error, I think:1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\playerball.h(5) : error C2504: 'Ball' : base class undefined   ;  Point.h doesn't need to #include playerball.h. Just use a forward declaration for the class.   ;  Easy, you fail at forward declarations. A forward declaration will only get you a reference not an object so your distance function is illegal.  Second why in the heck does point calculate the distance between two balls?  It really shouldn't know about them.  The C++ FAQ's take on the matter;Quote:Original post by stonemetalEasy, you fail at forward declarations. A forward declaration will only get you a reference not an object so your distance function is illegal. No, you only need a forward declaration to declare a function that takes a class object by value.;  Alrighty.  I think I fixed the issue.  I made a forward declaration of class PlayerBall in Point.h and solved my problem.  There is only one problem left.The compiler is telling me "1>Ball.cpp1>c:\users\nick\documents\visual studio 2008\projects\collision game\collision game\ball.cpp(10) : error C2276: '-' : illegal operation on bound member function expression"Here is the Ball.cpp file... slightly modified version of the above one.I've got a feeling that I'm trying to illegally access some part of my class. Not quite sure.[source lang=cplusplus]//Ball.cpp//#include <vector>#include "Ball.h"#include "point.h"#include "Constants.h"void Ball::WallCollision() //tests to see if a ball crashes into a wall and changes velocity if true{if (itsPosition.GetX() + 5 == RIGHT ) { itsVelocity.SetX ( - itsPosition.GetX ); }if (itsPosition.GetX() - 5 == LEFT  ) { itsVelocity.SetX ( - itsPosition.GetX ); }if (itsPosition.GetY() + 5 == TOP   ) { itsVelocity.SetY ( - itsPosition.GetY ); }if (itsPosition.GetY() - 5 == BOTTOM) { itsVelocity.SetY ( - itsPosition.GetY ); }}Ball::Ball (int x, int y){itsPosition.SetX ( x );    itsPosition.SetY ( y );}Ball::~Ball(){};  You're missing the () in your function calls. Ex:itsPosition.GetXshould beitsPosition.GetX()