-
linker error
Hey, can anyone help me figure out why I keep getting a "linker error" when running this program?
the error is- [Linker error] undefined reference to `billingamount(double, double, bool)'
Code:
#include <iostream>
#include <iomanip>
using namespace std;
double billingamount(double hourlyrate, double contime, bool incomestatus);
int main()
{
double income;
double hourlyrate;
double contime;
bool incomestatus;
cout <<"Enter income: ";
cin >> income;
cout << endl;
if(income<=25000)
incomestatus=1;
else
incomestatus=0;
cout << "Enter the hourly rate: ";
cin >> hourlyrate;
cout <<endl;
cout <<"Enter the total consulting time in minutes: ";
cin >> contime;
cout << endl;
cout << fixed << showpoint <<setprecision(2)<<endl;
cout <<"the billing amount is $" << billingamount(hourlyrate,contime,incomestatus) << endl;
system("pause");
return 0;
}
double billingamout(double hourlyrate, double contime, bool incomestatus)
{
double charges;
if (incomestatus)
if(contime<=30)
charges=0.0;
else
charges=hourlyrate*0.4*(contime-30)/60;
else if(contime<=20)
charges=0.0;
else
charges=hourlyrate*0.7*(contime-20)/60;
return charges;
}
-
You mispelled billing amount in your definition. Missed an n.
Future reference all the clues are in your error. If it says undefined reference then you need to look at your definition and see what's different.
-
Argh! Thank you! I read and re-read all 3 of those lines looking for the spelling mistake. I must have been looking for too long. lol Thanks
-
If in doubt just copy and paste the definition. Lol