我不明白爲什麼我的代碼打破了,我可以使用一些幫助。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