undefined reference to neededPaint()

What does 'undefined reference to paintNeeded()" mean here? I'm trying to call the function from the main passing reference variables. Trying to get this part right so I can go on with the other parts.
Thanks

// anna

#include <iostream>

using namespace std;

//fp
void paintNeeded(void);
//void allGalPrice();

//G C
const double AREA_FORMULA = 115.00;
const double AREAFORMULA_PAINT = 1.00;
const double AREAFORMULA_HOURS = 8.00;
const double AREAFORMULAHOURS_WAGES = 20.00;


int main()

{
double areaTP;
double paintCST;
//double paintTTL;

cout<<"Paint Job Estimator"<<endl;

cin>> areaTP;
cout<<"Enter the square footage to be painted, press enter."<<endl;

cin>> paintCST;
cout<<"Enter the price of a gallon of paint,press enter."<<endl;


cout << "The number of gallons of paint you need: " <<endl;
cout << "The price of paint you need: "<< endl;

paintNeeded();


cin.get();

return 0;
}

void paintNeeded(double& areaTP, double& paintCST)
{

areaTP = areaTP / AREA_FORMULA * AREAFORMULA_PAINT * paintCST;


//cout << "The number of gallons of paint you need: " <<endl;
//cout << "The price of paint you need: "<< endl;

}

void paintNeeded(void);

You are telling your compiler about a method that takes NO parameters.

Your implementation:
void paintNeeded(double& areaTP, double& paintCST)

i.e. you are telling your compiler about a method that takes TWO parameters.

in other words your declaration and implementation dont match.

Change your forward declaration to match your method.

AND obviously pass in some variables when you actually call it in main :)

paintNeeded(areaTP, paintCST);
Last edited on
Now I get

too many arguments to function "void" with paintNeeded(areaTP, paintCST);
and 'declared here' referring to the function prototype line.
Topic archived. No new replies allowed.