Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. class std::basic_ofstream errors

class std::basic_ofstream errors

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andrew Hoole
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • A 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

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • N Neville Franks

        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

        A Offline
        A Offline
        Andrew Hoole
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups