I was working on a problem for school to write methods for a program where main was already written, but got an error when compiling. Since im just learning any help and explanation would be helpful. Thanks.
Errors: undefined reference to `Employee::Employee(char const*, int, double)'
undefined reference to `Employee::Employee()'
undefined reference to `Employee::Employee(char const*, int, double)'
undefined reference to `Employee::Employee(char const*, int, double)'
undefined reference to `Employee::Employee(char const*, int, double)'
[Error] ld returned 1 exit status
Code:#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
const int MIN_ID = 1000;
const int MAX_ID = 9999999;
void Employee::increaseSalary (double incrementAmount){
if (incrementAmount <= 0){
cout << "the salary cannot be increased";
}
else {
salary += incrementAmount;
}
}
void Employee::setIDnum( int newIDnum){
if (newIDnum < MIN_ID or newIDnum > MAX_ID){
cout << "Error: the new identification number is invalid. It will be set to 1000";
idNum = 1000;
}
else{
idNum = newIDnum;
}
}
void Employee::setSalary( double newSalary ){
if (newSalary <= 0){
cout << "Error: the passed in salary is invalid. The salary will be set to 0.00";
salary = 0.0;
}
else {
salary += newSalary;
}
}