linker error HELP!!!!



#include <cstdlib>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>

using namespace std;

//define global vars
const int Column=15;
const int Row=2;
// define typedef strings
typedef char stringF[Column];
typedef char stringL[Column];
typedef char stringID[Column];
//initialize string arrays
stringF F_name[Row];
stringL L_name[Row];
stringID ID[Row];
//prototype arrays
void populate_array(const int&,const int&, stringF F_name[],stringL L_name[], stringID ID[],double Hours[],double Rate[]);
void calc_Overtime(const int&, double Hours[],double Overime[]);
void calc_Gross(const int&, double OverTime[], double Rate[],double Gross[]);
void calc_Fed(const int&, double Fed[],double Gross[]);
void calc_State(const int&, double State[],double Gross[]);
void calc_Union(const int&, double Union[],double Gross[]);
void calc_Net(const int&,double Fed[],double Union[],double Net[], double State[],double Gross[]);
void output(const int&,const int&, stringF F_name[],stringL L_name[], stringID ID[],double Hours[],double Rate[], double Fed[],double Union[],double Net[], double State[],double Gross[], double OverTime[]);










int main()
{
//initialize double arrays
double Hours[Row];
double Gross[Row];
double Rate[Row];
double OverTime[Row];
double State[Row];
double Fed[Row];
double Union[Row];
double Net[Row];
//call funcs
populate_array (Row, Column, F_name, L_name, ID, Hours, Rate);
calc_Overtime(Row, Hours, OverTime);
calc_Gross(Row, OverTime, Rate, Gross);
calc_Fed(Row, Fed, Gross);
calc_State(Row, State, Gross);
calc_Union(Row, Union, Gross);
calc_Net(Row, Fed, Union, Net, State, Gross);
output(Row, Column, F_name, L_name, ID, Hours, Rate, Fed, Union, Net, State, Gross, OverTime);
system("pause");return 0;}




void populate_array(const int Row, const int Column, stringF F_name[],stringL L_name[], stringID ID[],double Hours[],double Rate[])//function poplulates array with user input values
{
int Counter=0, Counter2=1;
while (Counter < Row)
{
cout<<"please input the first name of employee number maximum of 15 letters "<<Counter2<<endl;
cin>>F_name[Counter];

cout<< "please input the last name of employee number maximum of 15 letters "<< Counter2<<endl;
cin>>L_name[Counter];

cout<< "please input the ID# of employee number "<< Counter2<<endl;
cin>>ID[Counter];

cout<< "please input the hours worked of employee number "<< Counter2<<endl;
cin>>Hours[Counter];
while (Hours[Counter]< 40|| Hours[Counter]> 60)
{
cout<< "invalid input, please input the hours worked of employee number "<< Counter2<<endl;
cin>>Hours[Counter];
}
cout<< "please input the hours worked of employee number "<< Counter2 <<endl;
cin>>Rate[Counter];
while (Rate[Counter] < 0)
{
cout<< "invalid input, please input the hourly rate of employee number "<< Counter2<<endl;
cin>>Rate[Counter];
}
Counter++, Counter2++ ;
}
};


void calc_Overtime(const int Row, double Hours[], double OverTime[])//function calculates overtime
{
int Counter=0;
while (Counter < Row)
{
OverTime[Counter]= Hours[Counter]-40;
}
Counter++;
}


void calc_Gross(const int Row, double OverTime[], double Rate[],double Gross[])//function calculates Gross
{
int Counter=0;
while (Counter<Row)
{
Gross[Counter]= 40*Rate[Counter]+ Rate[Counter]*1.5*OverTime[Counter];
}
Counter++;
}

void calc_Fed(const int Row, double Fed[], double Gross[]) //function calculates Fed tax
{
int Counter=0;
while (Counter<Row)
{
Fed[Counter]= .05*Gross[Counter];
}
Counter++;
}

void calc_State(const int Row, double State[], double Gross[])//function calculates state tax
{
int Counter=0;
while (Counter<Row)
{
State[Counter]= .15*Gross[Counter] ;
}
Counter++;
}
void calc_Union(const int Row, double Union[], double Gross[])//function calculates Union fees
{
int Counter=0;
while(Counter<Row)
{
Union[Counter]= .02*Gross[Counter] ;
}
Counter++;
}

void calc_Net(const int Row,double Fed[],double Union[],double Net[], double State[], double Gross[])//function calculates Net
{
int Counter=0;
while (Counter<Row)
{
Net[Counter]= Gross[Counter]- State[Counter]-Union[Counter]-Fed[Counter];
}
Counter++;
}




void output(const int Row, const int Column, stringF F_name[], stringL L_name[], stringID ID[] ,double Hours[],double Rate[],double Fed[],double Union[],double Net[],double State[], double Gross[],double OverTime[])//function prints output to .txt file
{

cout<<" Company A B C" <<endl;
cout<<" = = = = = = = = " <<endl;
cout<<" pay Roll System" <<endl;
cout<<"================================================================================================================================================================================================================================"<<endl;
cout<< setw(15)<<" First name"<<setw(15)<<"Last name"<<setw(15)<<"Id#"<<setw(15)<<"Rate/h"<<setw(15)<<"OT hours"<<setw(15)<<"Gross"<<setw(15)<<"State Tax"<<setw(15)<<"Federal Tax"<<setw(15)<<"Union fees"<<setw(15)<<"Net"<<endl;
cout<< setw(15)<<" =============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<setw(15)<<"=============="<<endl;
while (Counter<Row)
{
cout<<setw(15)<<F_name[Counter]<<setw(15)<<L_name[Counter]<< setw(15)<<ID[Counter]<<setw(15)<<Rate[Counter]<<setw(15)<<OverTime[Counter]<<setw(15)<<Gross[Counter]<<setw(15)<<State[Counter]<<setw(15)<<Fed[Counter]<<setw(15)<<Union[Counter]<<setw(15)<<Net[Counter]<<endl;
Counter++;
}}









I'm getting
"[Linker error] undefined reference to `calc_Overtime(int const&, double*, double*)' " for every function.
What am I doing wrong? please help I need to hand this in in 3 hours!!!!!!
1
2
3
4
5
6
//declaration
void calc_Overtime(const int&, double Hours[],double Overime[]);
//definition
void calc_Overtime(const int Row, double Hours[], double OverTime[])
//Spot the difference
//Hint: this is two completely different functions 
Last edited on
Topic archived. No new replies allowed.