ifstream issue in Visual C++ .NET 2005
-
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
-
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
-
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!
-
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
-
ifstream is in the std namespace, either use
std::ifstream
orusing namespace std;
.
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!