I cannot figure out why my code is breaking, and I could use some help.
First of all, the code:
Timer.h:
#include [...]
class Timer {
public:
[...]
Timer operator+(double);
[...]
private:
[...]
void correctthedate(int day, int month, int year);
[...]
};
Timer.cc:
#include "Timer.h"
using namespace std;
[...]
void correctthedate(int day, int month, int year) {
[...]
}
[...]
Timer Timer::operator+(double plush) {
[...]
correctthedate(curday, curmonth, curyear);
return *this;
}
When I try to compile I get the error:
Timer.o: In function `Timer::operator+(double)':
Timer.cc:(.text+0x1ad3): undefined reference to `Timer::correctthedate(int, int, int)'
Any pointers in the right direction? Thanks!
The following line:
should read
Otherwise you’re just defining an unrelated function called
correctthedate().