Having problems!!!!error LNK2019: unresolved external symbol "public: void

// Program Name: Class Development
// Programmer: Alicia Long
//CIS247C: Week 4 lab
//Program Description: Provide a description of the program

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

class Benefit
{
private:
string healthInsurance;
double lifeInsurance;
int vacation;

public:
Benefit();
Benefit(string, double, int);
void displayBenefits();
string getHealthInsurance();
void setHealthInsurance(string);
double getLifeInsurance();
void setLifeInsurance(double);
int getVacation();
void setVacation(int);
};

Benefit::Benefit()
{
healthInsurance = "not provided";
lifeInsurance = (0.0);
vacation = (14);
}

Benefit::Benefit(string health, double life, int vacation)
{
healthInsurance = health;
lifeInsurance = life;
vacation = vacation;
};

void Benefit::displayBenefits()
{
cout << "Benefit Information" << "\n";
cout << "________________________________________________________________" << endl;
cout << "Health Insurance: " << healthInsurance << "\n";
cout << "Life Insurance: " << lifeInsurance << "\n";
cout << "Vacation: " << vacation << " days" << "\n";
}

string Benefit::getHealthInsurance()
{
return healthInsurance;
}

void Benefit::setHealthInsurance(string HealthInsurance)
{
healthInsurance = HealthInsurance;
}

double Benefit::getLifeInsurance()
{
return lifeInsurance;
}

void Benefit::setLifeInsurance(double LifeInsurance)
{
lifeInsurance = LifeInsurance;
}

int Benefit::getVacation()
{
return vacation;
}

void Benefit::setVacation(int vaca)
{
vacation = vaca;
}

class iEmployee
{
public:
virtual double calculatePay()= 0;
};

class Employee : public iEmployee
{

private:
string firstName;
string lastName;
char gender;
int dependents;
double annualSalary;
static int numEmployees;

public:
Employee();
Employee(string first, string last, char gen, int dep, double salary, Benefit);
double calculatePay();
void displayEmployee();
string getFirstName();
void setFirstName(string);
string getLastName();
void setLastName(string);
char getGender();
void setGender(char);
int getDependents();
void setDependents(int);
double getAnnualSalary();
void setAnnualSalary(double);

static int getNumEmployees();
void setDependents(string);
void setAnnualSalary(string);
Benefit benefit;
};

void DislayApplicationInformation();
void DisplayDivider(string);
void DisplayDivider2(string);
string GetInput (string);
void TerminateApplication();
int Employee::numEmployees = 0;

Employee::Employee(string first, string last, char gen, int dep, double salary, Benefit ben)
{
benefit = ben;
firstName = first;
lastName = last;
gender = gen;
dependents = dep;
annualSalary = salary;
numEmployees++;
}

double Employee::calculatePay()
{
return annualSalary/52;
}

void Employee::displayEmployee()
{
cout << "Employee Name:\t\t" << firstName << " " << lastName << endl;
cout << "Employee Gender:\t" << gender << endl;
cout << "Employee Dependents:\t" << dependents << endl;
cout << "Employee Annual Salary:\t$" << setprecision(2) << showpoint << fixed << annualSalary << endl;
cout << "Employee Weekly Pay:\t$" << setprecision(2) << showpoint << fixed << calculatePay() << endl;
benefit.displayBenefits();
cout << "\n--- Number of Employee Objects Created ----" << endl;
cout << "Number of employees: " << Employee::getNumEmployees() << endl;
}

string Employee::getFirstName()
{
return firstName;
}

void Employee::setFirstName(string newFirstName)
{
firstName = newFirstName;
}

string Employee::getLastName()
{
return lastName;
}

void Employee::setLastName(string newLastName)
{
lastName = newLastName;
}

char Employee::getGender()
{
return gender;
}

void Employee::setGender(char)
{
gender = gender;
}

int Employee::getDependents()
{
return dependents;
}

void Employee::setDependents(int newDependents)
{
dependents = newDependents;
}

double Employee::getAnnualSalary()
{
return annualSalary;
}

void Employee::setAnnualSalary(double newAnnualSalary)
{
annualSalary = newAnnualSalary;
}

void Employee::setAnnualSalary(string sal)
{
Employee::setAnnualSalary( atof(sal.c_str()));
}

int Employee::getNumEmployees()
{
return Employee::numEmployees;
}

int main()
{
DislayApplicationInformation();
DisplayDivider("Employee 1");

Employee employee1;
char gender;
string tempString;

employee1.setFirstName(GetInput("First Name "));
employee1.setLastName(GetInput("Last Name "));

tempString = GetInput("Gender ");
gender = tempString.at(0);
employee1.setGender(gender);

employee1.setDependents(GetInput("Dependents "));
employee1.setAnnualSalary(GetInput("Annual Salary "));

Benefit benefit;
double lifeInsurance;
int vacation;

employee1.benefit.setHealthInsurance(GetInput("Health Insurance"));

tempString = GetInput("Life Insurance");
lifeInsurance = atoi(tempString.c_str());
employee1.benefit.setLifeInsurance(lifeInsurance);

tempString = GetInput("Vacation");
vacation = atoi(tempString.c_str());
employee1.benefit.setVacation(vacation);

DisplayDivider2("Employee Information");
employee1.displayEmployee();
cout << endl;

Benefit benefit1("North West Mutual", 240000, 14);
Employee employee2("Mary", "Noia", 'F', 5, 24000.0, benefit1);

DisplayDivider("Employee 2");
DisplayDivider2("Employee Information");
employee2.displayEmployee();

TerminateApplication();

return 0;
}

void DislayApplicationInformation()
{
cout << "Welcome the Basic User Interface Program" << endl;
cout << "CIS247C, Week 4 Lab" << endl;
cout << "Name: Alicia Long" << endl;
}

void DisplayDivider(string outputTitle)
{
cout << "\n************************" << outputTitle <<"************************" << "\n";
}

void DisplayDivider2(string outputTitle)
{
cout << "\n" << outputTitle << endl;
cout << "\n________________________________________________________________" << "\n";
}

string GetInput (string inputType)
{
string input;
cout<<"Enter the "<< inputType << endl;
getline(cin, input);
return input;
}

void TerminateApplication()
{
cout << "Thank you for using the Basic Interface program" << endl;
}
Last edited on
Will you please use code tags and write out the full error (including line number) in the post.
It want allow me to write out the full error.

Error 2 error LNK2019: unresolved external symbol "public: void __thiscall Employee::setDependents(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?setDependents@Employee@@QAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main

Error 1 error LNK2019: unresolved external symbol "public: __thiscall Employee::Employee(void)" (??0Employee@@QAE@XZ) referenced in function _main
You're passing a string to a function (Employee::setDependents) that expects an int. Also if you're going to post compilable code, can you at least put it in code tags (for the reference there is an edit button) and if you can, get rid of the functions that are not relevant to the error.
Topic archived. No new replies allowed.