我不明白为什么我的代码打破了,我可以使用一些帮助。C++“未定义的引用...”
首先,代码:
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;
}
当我尝试编译我的错误:
Timer.o: In function `Timer::operator+(double)':
Timer.cc:(.text+0x1ad3): undefined reference to `Timer::correctthedate(int, int, int)'
右侧目录中的任何指针挠度?谢谢!
时间/计时器?你有一个混合在这里。 – crashmstr