error binary '<<'
-
Folgentes
InFile.open(OUTPUTSORTEDFILES, ios::in); //block copy for(CounterMaxFiles = 0; CounterMaxFiles < MaxFiles; CounterMaxFiles++) { for(CounterBlockSize = 0; CounterBlockSize < MaxBlockSize; CounterBlockSize++) { InFile >> Temp; this->itsArrayIFStream[CounterMaxFiles] << Temp;!----hier fehler } }
Und zwar.
Compiling...
Main.cpp
c:\windows\desktop\basis 3\database\sortingblock\block.hpp(355) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class CLIENT' (or there is no acceptable conversion)
c:\windows\desktop\basis 3\database\sortingblock\block.hpp(471) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class CLIENT' (or there is no acceptable conversion)
c:\windows\desktop\basis 3\externalfilesort\externalfilesort.hpp(190) : error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ifstream<char,struct std::char_traits<char> >' (or there is no acceptabl
e conversion)
c:\windows\desktop\basis 3\externalfilesort\externalfilesort.hpp(305) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class CLIENT' (or there is no acceptable conversion)
Error executing cl.exe.Main.exe - 4 error(s), 0 warning(s)
Ich bekomme uberal wo ich den operator<<(für ifstream und istrea) von der classe CLINT aufrufe error. Aber warum.
//ifstream>> friend ifstream &operator>>(ifstream &finput, CLIENT &rhs)finput >> rhs.itsATNumber;finput.ignore();finput >> rhs.itsFirstName;finput.ignore();finput >> rhs.itsLastName;finput.ignore();finput >> rhs.itsStreet;finput.ignore();finput >> rhs.itsStreetNumber;finput.ignore();finput >> rhs.itsZipCode;finput.ignore();finput >> rhs.itsStatus;finput.ignore();return finput;}
-
Master User schrieb:
operator<<
operator>>
-
friend ofstream &operator<<(ofstream &foutput, const CLIENT &rhs) { foutput << rhs.itsATNumber << ' ' << rhs.itsFirstName << ' ' << rhs.itsLastName << ' ' << rhs.itsStreet << ' ' << rhs.itsStreetNumber << ' ' << rhs.itsZipCode << ' ' << rhs.itsStatus; return foutput; }
funktioniert aber immer noch nicht.
Compiling...
Main.cpp
c:\windows\desktop\basis 3\main.cpp(71) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class CLIENT' (or there is no acceptable conversion)
Error executing cl.exe.Main.exe - 1 error(s), 0 warning(s)
[cpp]
int main(int argc, char *argv[])
{
CLIENT BTest;
ofstream Test("klo.txt", ios::out);
cin >> BTest;
Test << BTest;
return (EXIT_SUCCESS);
}
-
Bei mir klappt das. Kannst du ein Minimalbeispiel zeigen, das den Fehler reproduziert?
-
Nun ich habe jetzt den fehler lokaliziert. Wenn ich z.b. CLIENT A; benutze klapt alles. Aber wenn ich jetzt CLIENT *A; Benutze und später dann mit new ein array mit z.b. 10 CLIENTS mache und ich später ein clienta ausdrujen will z.b. *(A + 1); dann bekomme ich den error. Hilft das villeicht weiter?.
-
Die wege des Bill Gates sind unergründlich!, nun ich habe jetzt mein ganzen source code neugeschrieben, und siehe da es funktioniert jetzt, hofentlich bleibt es auch so.