私のUbuntu環境にはヘッダーが含まれていないため、ヘッダーの宣言を変更するためにいくつかのコードを移行しています。最終的にすべてのファイルを変更しましたが、次のエラーが発生しています。
Item.h:33: error: reference to ‘ostream’ is ambiguous
Item.h:16: error: candidates are: struct ostream
/usr/include/c++/4.4/iosfwd:130: error: typedef struct
std::basic_ostream<char, std::char_traits<char> > std::ostream
Item.h:33: error: ISO C++ forbids declaration of ‘ostream’ with no type
Item.h:33: error: ‘ostream’ is neither function nor member function; cannot be declared friend
コードは次のとおりです。
class Item
{
public:
Item( //const Wrd* hd,
const Term * _term, int _start, int _finish );
~Item();
int operator== (const Item& item) const;
friend ostream& operator<< ( ostream& os, const Item& item ); // <-- error
これを修正する方法を知っている人はいますか?