class std::basic_ofstream errors
-
Hi Can anyone help me. I have a large project that I have compiled many times before no problem but today it is suddenly throwing all sorts of errors. They appear to be connected to the standard C++ library. One of the errors is: error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ofstream >' (or there is no acceptable conversion) This is thrown on trying to compile the following code void C3DPoint::Save(ofstream & s) { s << x <<" " << y << " " << z << endl; } where the header file has the following includes #include #include using namespace std; class C3DPoint : public CObject { DECLARE_DYNCREATE(C3DPoint) public: . . . . int x; int y; int z; . . . }; Does anyone know the reason for these types of errors. Many thanks in advance for any help. Andrew Hoole
-
Hi Can anyone help me. I have a large project that I have compiled many times before no problem but today it is suddenly throwing all sorts of errors. They appear to be connected to the standard C++ library. One of the errors is: error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ofstream >' (or there is no acceptable conversion) This is thrown on trying to compile the following code void C3DPoint::Save(ofstream & s) { s << x <<" " << y << " " << z << endl; } where the header file has the following includes #include #include using namespace std; class C3DPoint : public CObject { DECLARE_DYNCREATE(C3DPoint) public: . . . . int x; int y; int z; . . . }; Does anyone know the reason for these types of errors. Many thanks in advance for any help. Andrew Hoole
It is very difficult to comment as your code sample isn't showing < >. You should select code you post and use the pre and code and < > Formatting options below the edit area. Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
-
It is very difficult to comment as your code sample isn't showing < >. You should select code you post and use the pre and code and < > Formatting options below the edit area. Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
Oops. Sorry about that. Let me try again. Error message was error C2678: binary '<<' : no operator defined which takes a left-hand operand of type 'class std::basic_ofstream >' (or there is no acceptable conversion) Thrown by code void C3DPoint::Save(ofstream & s) { s << x <<" " << y << " " << z << endl; } With header #include #include using namespace std; class C3DPoint : public CObject { DECLARE_DYNCREATE(C3DPoint) public: . . . . int x; int y; int z; . . . }; Another error in a different source file is error C2079: 'file' uses undefined class 'basic_ifstream >' associated with code line ifstream file(dlg.GetPathName(),ios::in); Many thanks for any help. Andrew Hoole