Skip to main content
GameDev.net gamedev.net
🔒 Locked

variable or field declared void-error?

Started by uridicy Sep 25, 2006 at 12:19 AM 1 replies 4.3k views
Original Post
uridicy
uridicy
Ok, I'm working on a remake of the program called breakout for a school assignement and I'm getting this one error: \Squares.h variable or field `squareCollision' declared void The acctual function in the .h file is simple:
void squareCollision(Ball *ballPointer);
and the implementation in the .cpp file is:
void squareCollision(Ball *ballPointer){
  for(int i = 0; i < ROW_SIZE * COLUMN_SIZE; i++)
    {
     if(squareExists == true){        
      if(ballPointer->ballX <= highX && ballPointer->ballX >= lowX) 
      {
        if(ballPointer->ballY <= highY && ballPointer->ballY >= lowY)
        {
        squareExists = false;
        ballPointer->ballYVelocity = -ballPointer->ballYVelocity;
        ballPointer->ballXVelocity = -ballPointer->ballXVelocity;
        player1_points++;
        }
      }      
     }
    }            
}
Now I'm trying to make the squareCollision(Ball *ballPointer) function take an object of type "Ball" and pass it to the function so I can modify/access the variables in the function. Am I doing this correctly? Also, does anyong know why I might be getting that particular error?
Pixel art/3D art portfolio: http://myweb.csuchico.edu/~lkester/
WarAmp
WarAmp
You will need to post the lines around that error. It seems to me like you are declaring that function inside an array or something? Also, what language are you trying to use? ANSI C? C++?
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
uridicy
uridicy
I'm using c++ with the dev C++ programming environment. Acctually I think I fixed this error, but now I'm getting linking errors for all my functions outside the main.cpp file.
Pixel art/3D art portfolio: http://myweb.csuchico.edu/~lkester/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.