I have a function, prototyped as below:
double gradeCalc (double midterm, double final, const vector<double>& hwGrades);
in my code I pass the variable homework, declared as
vector<double> homework;
into the third argument. I get the below error:
undefined reference to `gradeCalc(double, double, std::vector<double, std::allocator<double> >)'
In the textbook I'm working from, the function prototype is the same, yet there is no mention of this error. It seems the type of homework is not what I thought it was. What have I done wrong? (and what is an allocator for that matter?)
edit full function definition below as requested:
double gradeCalc (double midterm, double final, const vector<double> & hwGrades) {
if (hwGrades.size() == 0) {
throw domain_error("homework grades list empty");
}
double median = vdMedian(hwGrades);
return 0.2 * midterm + 0.4 * final + 0.4 * median;
}
edit #2 found. silly typographical error. would still be interested to know what an allocator is. happy to ask in a seperate question.