fstreamを使用していてエラーが発生しました。iostreamでC++コンパイルエラーが発生しました
class CLog
{
void printOn(std::ostream& dbg) const;
}
void operator>>(const CLog& s, std::ofstream& dbg)
{
s.printOn(dbg);
}
しかし、私はコンパイル時に、私は次のエラーました:ofstreamのは、それが不可能なので、なぜostreamに継承することを
error C2664: 'printOn' : cannot convert parameter 1 from
'class std::basic_ofstream<char,struct std::char_traits<char> >' to
'class std::basic_ostream<char,struct std::char_traits<char> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
私は思ったがここ
は私が持っているものでしょうか?出力オペレータの
おかげ
Arggg!見つからなかった '#include'を見つけました。コンパイラからの愚かな出力。ありがとうございます –
mathk