Ich benutze fstream und habe einen Fehler bekommen.C++ Kompilierfehler mit Iostream
Hier ist, was ich habe:
class CLog
{
void printOn(std::ostream& dbg) const;
}
void operator>>(const CLog& s, std::ofstream& dbg)
{
s.printOn(dbg);
}
Aber wenn ich kompilieren Ich habe folgende Fehlermeldung:
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
Ich dachte, dass ofstream von Ostream erben also warum es nicht möglich ist?
Dank
Arggg! fand eine fehlende '#include'. Was für eine blöde Ausgabe vom Compiler. Danke alle –
mathk