[Linker error] undefined reference to `play(int)'

i am having a problem with my code. I keep getting:

[Linker error] undefined reference to `play(int)'
ld returned 1 exit status
im pretty new at programming in c++, and from what i have found on the web, nothing much helped, and i think that the problem is really specific on the code. If anyone can offer help, i would be greatful.
here is my code:



#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

const int MIN_NUMBER = 1,
MAX_NUMBER = 100;
int randomNumber(int low ,int high);
int askNumber(int low,int high);
void welcomePlayer();
void play(int aSecretNumber);



int main(){
int low,
high;
srand(static_cast<unsigned int>(time(0)));

welcomePlayer();
int aSecretNumber = randomNumber(MIN_NUMBER, MAX_NUMBER);
play(aSecretNumber);

cin.ignore(1000,'\n');
cin.get();
return 0;
}


void welcomePlayer(){
cout << "Welcome to guess my number!!" << endl
<< "The computer will randomly generate a number betwneen 1 and 100, " << endl
<< "and you have to guess it." << endl
<< "Good Luck!" << endl;
}


int randomNumber(int low, int high)
{
int range = high - low + 1;
return ((rand() % range) + low);
}


void play(){
cout << askNumber(MIN_NUMBER,MAX_NUMBER);
}


int askNumber(int low,int high){
int guess,
aSecretNumber;

while(guess != aSecretNumber){
cout << "\nEnter a guess: ";
cin >> guess;

if (guess > aSecretNumber){
cout << "Too high!\n\n";
}
else if (guess < aSecretNumber){
cout << "Too low!\n\n";
}
else
{
cout << "\nThat's it!" << endl
<< "Good Job!!" << endl;
}
}
}
play(aSecretNumber);

You're trying to call a function called play that accepts an integer as input parameter. There is no such function. You have not written one.

You have written a function called play that accepts no input parameters; this one.

void play(){
cout << askNumber(MIN_NUMBER,MAX_NUMBER);
}


Change the function so that it accepts an input parameter of type int.
Topic archived. No new replies allowed.