Linker error?

It keeps giving me a Linker error in the DaysOut function and also the findAverage function. I have no idea what is wrong and I've been trying to throw in all sorts of different combinations but I just can't seem to get it compiled. Any help is appreciated

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  //MrBrewski99
//This program will ask the user for the amount of employees at a company and how many days each employee missed.
//It will then find the average amount of days missed and display in the main() function.

#include <iostream>
#include <iomanip>
using namespace std;

int numEmployees();
int daysOut();
double findAverage();

int main()
{
    //double answer;
    
    numEmployees();
    daysOut();
    findAverage();
    double average;
    
    cout << setprecision(2) << fixed;
    cout << "The average amount of days missed was " << average << endl;
    
    system("pause");
    return 0;
}

int numEmployees()
{
    int employee;
    
    cout << "How many employees are employeed at ths company?" << endl;
    cin >> employee;
    return (employee);
       
} //end numEmployees

int daysOut(int employee)
{
    int temp, absent = 0, counter = 1;
    
    while (counter <= employee)
    {
          cout << "How many days was employee " << counter << " absent from work?" << endl;
          cin >> temp;
          
          absent = (temp + absent);
          counter + 1;
    
    } //end while
    
   return (absent); 
    
} //end daysOut

double findAverage(int employee, int absent)
{
       double average ;
       
       average = (employee / absent);
       
       return (average);
Your forward declarations
1
2
int daysOut();
double findAverage();

are different from your definitions:
int daysOut(int employee)

double findAverage(int employee, int absent)

Technically this means you are declaring 2 different versions of each function. In your main() you are calling the versions that you forward declared (daysOut(), no parameters) which has been declared but never defined.
Last edited on
Thanks...I guess I overlooked that. Seems so simple. Thanks a lot!
Topic archived. No new replies allowed.