I started a program that calculates an employee's weekly gross pay when the user inputs hours worked and hourly pay rate. With what I have so far, it compiles fine, but gives these errors:

on Dev-C++:
message: [Linker error] undefined reference to 'get_pay(float, float)'
Id returned 1 exit status
file: C:\Dev-Cpp\Programs\Makefile.win message: [Build Error][grossPay.exe] Error 1

on Visual Studio 2005:
1>------ Build started: Project: grossPay, Configuration: Debug Win32 ------
1>Linking...
1>grossPay.obj : error LNK2019: unresolved external symbol "void __cdecl get_pay(float,float)"

How do I resolve this linker error? And also, how would I add if/else statements for the following condition? If the employee's weekly gross pay is more than $200 (personal exemption), then the employee pays 12% federal tax and 5% state tax from his taxable income (gross pay - exemption). I'd also like to combine the functions I have so that taxable income, fed tax, and state tax are all calculated in the same function.

Here's what I have:

#include <cstdlib>
#include <iostream>

using namespace std;

void get_pay(float wage, float hours);
float calc_gross_pay(float wage, float hours);
float calc_net(float gross, float deduct);
void print_gross_pay(float);
void print_net(float);

int main(int argc, char *argv[])
{
float wage,hours,gross,deduct,sum;

get_pay(wage, hours);
gross = calc_gross_pay(wage, hours);
sum = calc_net(gross, deduct);
print_gross_pay(gross);
print_net(sum);

system("PAUSE");
return EXIT_SUCCESS;
return 0;
}

void get_pay(float& wage, float& hours)
{
cout << "Enter your hourly wage: ";
cin >> wage;
cout << "Enter your hours worked: ";
cin >> hours;
}

float calc_gross_pay(float wage, float hours)
{
return wage * hours;
}

float calc_net(float gross, float deduct)
{
return gross - deduct;
}

void print_gross_pay(float gross)
{
cout << "Your gross pay is: " << gross;
}

void print_net(float sum)
{
cout << "Your net pay is: " << sum;
}

Your function declaration:

void get_pay(float wage, float hours)

and your function implementation:

void get_pay(float& wage, float& hours)

need to match. Please format and use code tags.

[code]

// paste code here

[/code]

Thank you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.