ちなみに、arch linux で eclipse と g++ を使用しています (1 週間も前に pacman -Syu を実行したので、すべて最新の状態です)。
これをコンパイルしようとするたびに、Eclipse はエラーを生成します。
#ifndef DATE_HPP_
#define DATE_HPP_
using namespace std;
class Date {
public:
int Year;
char Month;
char Day;
char HH;
char MM;
char ss;
Date();
/*
* Overloaded Operator Functions
*/
//Assignments
Date operator=(Date input);
//Comparisons
bool operator==(Date& rhs);
bool operator!=(Date& rhs);
bool operator<(Date& rhs);
bool operator>(Date& rhs);
bool operator<=(Date& rhs);
bool operator>=(Date& rhs);
//Conversion
operator char*();
operator std::string();
ostream& operator<<(ostream& os, const Date& date); //TROUBLE LINE
};
#endif /* DATE_HPP_ */
Eclipse は、operator<< 宣言に、引数を 1 つだけ持つ必要があるというメッセージを表示します。それでも、次のように宣言すると:
ostream& operator<<(const Date& date);
2つある必要があると不平を言います。私は何を間違っていますか?