Undefined reference

I am still new to this so I do not know how to fix the errors. When I compile, I keep getting the errors "Undefined reference to 'Pokeball::Pokeball()", "Undefined reference to 'Pokeball::draw(Plotter&)" and "Undefined reference to 'Pokeball::erase(Plotter&)". Can someone please tell me how to fix this?

[code]
#include "Game.h"

Game::Game()
{
active = true;
isOver = false;

powerUp = NO_POWER;

//Background
for(int r = 0; r < MAX_Y; r++)
{
for(int c = 0; c < MAX_X; c++)
{
if(r < MAX_Y - GROUND_HEIGHT)
{
screen.setColor(blue); //Sky
}
else if(r >= MAX_Y - GROUND_HEIGHT)
{
screen.setColor(darkred); //Ground
}

screen.plot(x+c, y+r, SQUARE);
}
}

x = y = 0;
}

void Game::title()
{
bool playGame = false;
int startKey;

do
{
message.drawStart(screen);

if(kbhit())
startKey = getch();

if(startKey == KEY_SPACEBAR)
playGame = true;

}while(!playGame);

message.eraseStart(screen);
}

void Game::play()
{
//int cloudTime = 0, cloudMaxTime = 10;
int meowthTime = 0, meowthMaxTime = 25;
int pokeballTime = 0, pokeballMaxTime = 75;

while(powerUp != DEAD)
{
//input
if(isJumping())
{
pika.setState(JUMPING);
}


//update
//cloudTime++;
meowthTime++;
pokeballTime++;

meowthCollision();
pokeballCollision();


//draw
/*
if(cloudTime > cloudMaxTime)
{
nube[0].draw(screen);
cloudTime = 0;
}
*/

if(powerUp == NO_POWER)
{
pika.draw(screen);
}

/*
else if (powerUp == BEAR_POWER)
{
oso.draw(screen);
}
*/

if(meowthTime > meowthMaxTime)
meowster.draw(screen);

if(pokeballTime > pokeballMaxTime)
pelota.draw(screen);

}
}

void Game::gameOver()
{
int gameOverKey;

message.gameover();

if(kbhit())
{
gameOverKey = getch();
}

if(gameOverKey == KEY_Y || gameOverKey == KEY_LOWER_Y)
isOver = true;
else if(gameOverKey == KEY_N || gameOverKey == KEY_LOWER_N)
isOver = false;

}

bool Game::isJumping()
{
bool flag = false;
int key;

if(kbhit())
{
key = getch();
}

if(key == ARROW)
{
key = getch();

if(key == UP_ARROW)
{
flag = true;
}
}
else if(key == KEY_W)
{
flag = true;
}
else if(key == KEY_SPACEBAR)
{
flag = true;
}

/*
if(flag == true)
{
PlaySound("./Sounds/smb_jump-small.wav", NULL, SND_FILENAME | SND_ASYNC);
}
*/
return flag;
}


bool Game::meowthCollision()
{
bool flag = false;

//leMario
int leftmostPikachu = pika.getX();
int rightmostPikachu = pika.getX() + PIKACHU_WIDTH;
int topmostPikachu = pika.getY();
int lowermostPikachu = pika.getY() + PIKACHU_HEIGHT;

int leftmostMeow = meowster.getX();
int topmostMeow = meowster.getY();
int bottommostMeow = meowster.getY() + MEOWTH_ROW;

if(powerUp == NO_POWER)
{
//If leftmost or rightmost Mario are between the drink's left or rightmost.
if( (rightmostPikachu >= leftmostMeow) && (leftmostPikachu <= leftmostMeow) )
{ //Topmost or lowermost are between drink's top or bottom.
if( ((topmostPikachu <= topmostMeow) && (lowermostPikachu >= topmostMeow)) ||
( ((topmostPikachu <= bottommostMeow) && (lowermostPikachu >= bottommostMeow) )))
{ //Turn true!
flag = true;
}
}
}

if(flag)
{
if(powerUp == NO_POWER)
{
//PlaySound("./Sounds/smb_mariodie.wav", NULL, SND_FILENAME | SND_ASYNC);

powerUp = DEAD;

}

meowster.setActive(false);
meowster.erase(screen);
}

return flag;
}

bool Game::pokeballCollision()
{
bool flag = false;

//Pikachu
int leftmostPikachu = pika.getX();
int rightmostPikachu = pika.getX() + PIKACHU_WIDTH;
int topmostPikachu = pika.getY();
int lowermostPikachu = pika.getY() + PIKACHU_HEIGHT;

int leftmostPokeball = pelota.getX();
int topmostPokeball = pelota.getY();
int bottommostPokeball = pelota.getY() + BALL_ROW;

if(powerUp == NO_POWER)
{
//If leftmost or rightmost Pikachu touch the Pokeball
if( rightmostPikachu >= leftmostPokeball && leftmostPikachu <= leftmostPokeball )
{ //Topmost or lowermost touch the Pokeball
if( ((topmostPikachu <= topmostPokeball) && (lowermostPikachu >= topmostPokeball)) ||
( ((topmostPikachu <= bottommostPokeball) && (lowermostPikachu >= bottommostPokeball))) )
{ //Turn true!
flag = true;
}
}
}

if(flag)
{
if(powerUp == NO_POWER)
{
//PlaySound("./Sounds/smb_mariodie.wav", NULL, SND_FILENAME | SND_ASYNC);

powerUp = DEAD;

}

pelota.setActive(false);
pelota.erase(screen);
}

return flag;
}

void Game::titleMap()
{
//screenMap[1][1];
}





#ifndef GAME_H_INCLUDED
#define GAME_H_INCLUDED

#include "plotter.h"
#include "constants.h"
#include "Point.h"
#include "Pikachu.h"
#include "Pokeball.h"
#include "Meowth.h"
#include "Banner.h"

class Game
{
private:
Plotter screen;
bool active, isOver;
int x, y;
int powerUp;
//Cloud nube[3];
Pikachu pika;
Pokeball pelota;
Meowth meowster;
Banner message;

public:
Game();
void title();
void play();
void gameOver();
bool isJumping();

void titleMap();
void gameOverMap();

bool meowthCollision();
bool pokeballCollision();

bool getIsOver() {return isOver;}
};
These errors indicate that you've declared some function prototypes, but you haven't written the associated function bodies.

The three offending functions are:

1.) Pokeball::Pokeball() - the Pokeball constructor which takes no arguments.
2.) Pokeball::draw(Plotter&)
3.) Pokeball::erase(Plotter&)

In other words, these three prototypes exist presumably in "Pokeball.h", but they haven't been defined.
Topic archived. No new replies allowed.