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. ifstream issue in Visual C++ .NET 2005

ifstream issue in Visual C++ .NET 2005

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharp
5 Posts 2 Posters 1 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.
  • Y Offline
    Y Offline
    yellowine
    wrote on last edited by
    #1

    I got an error for the following codes regarding ifstream: #include <fstream> #include <afxtempl.h> class CMyclass: public CObject { public: CMyclass(); DECLARE_SERIAL (CMyclass) virtual ~CMyclass(); public: // // other methods here // BOOL OnLoadData(ifstream& inFile); // load data from a file stream }; When compile this header, I got "error C2061: syntax error : identifier 'ifstream'" message. I am wondering why 'ifstream' is NOT defined in <fstream> (it should be as msdn says). Thanks. -- modified at 16:31 Tuesday 14th March, 2006

    PJ ArendsP 2 Replies Last reply
    0
    • Y yellowine

      I got an error for the following codes regarding ifstream: #include <fstream> #include <afxtempl.h> class CMyclass: public CObject { public: CMyclass(); DECLARE_SERIAL (CMyclass) virtual ~CMyclass(); public: // // other methods here // BOOL OnLoadData(ifstream& inFile); // load data from a file stream }; When compile this header, I got "error C2061: syntax error : identifier 'ifstream'" message. I am wondering why 'ifstream' is NOT defined in <fstream> (it should be as msdn says). Thanks. -- modified at 16:31 Tuesday 14th March, 2006

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      If you modify your post, changing the <s to <s we might be able to figure out what your problem is.


      You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

      Within you lies the power for good; Use it!

      Y 1 Reply Last reply
      0
      • PJ ArendsP PJ Arends

        If you modify your post, changing the <s to <s we might be able to figure out what your problem is.


        You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

        Y Offline
        Y Offline
        yellowine
        wrote on last edited by
        #3

        Thanks for that hint. Now I think the original post has been modified as it should.

        1 Reply Last reply
        0
        • Y yellowine

          I got an error for the following codes regarding ifstream: #include <fstream> #include <afxtempl.h> class CMyclass: public CObject { public: CMyclass(); DECLARE_SERIAL (CMyclass) virtual ~CMyclass(); public: // // other methods here // BOOL OnLoadData(ifstream& inFile); // load data from a file stream }; When compile this header, I got "error C2061: syntax error : identifier 'ifstream'" message. I am wondering why 'ifstream' is NOT defined in <fstream> (it should be as msdn says). Thanks. -- modified at 16:31 Tuesday 14th March, 2006

          PJ ArendsP Offline
          PJ ArendsP Offline
          PJ Arends
          wrote on last edited by
          #4

          ifstream is in the std namespace, either use std::ifstream or using namespace std;.


          You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

          Within you lies the power for good; Use it!

          Y 1 Reply Last reply
          0
          • PJ ArendsP PJ Arends

            ifstream is in the std namespace, either use std::ifstream or using namespace std;.


            You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

            Y Offline
            Y Offline
            yellowine
            wrote on last edited by
            #5

            Got it. Thanks.

            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