I am trying to migrate from VC++6 to VC++9. I am getting error
" fatal error C1083: Cannot open include file: 'fstream.h': No such file or directory" on build.
I tried removing .h and adding using namespace std; after #include, here it gives me error in iosfwd file like
"iosfwd(574) : error C2146: syntax error : missing ';' before identifier '_Char_traits_cat'".. i am not sure what this is...

Thanks in advance!!!

Recommended Answers

All 4 Replies

I didn't realize VC++ 6.0 even supported fstream.h.

You will most likely have to make several code changes during the port from 6.0 to 2010 compilers because 6.0 was not very compliant with c++ standards and allowed a lot of non-standard coding. So just fix the problems one at a time, such as change #include <fstream.h> to #include <fstream> (Drop the .h extension). Then you will most likely have to add the using statements.

The second error you posted I would ignore for now. Fix the fstream.h problem and that second error will probably go away.

#include <fstream.h>

and similar aren't correct C++, and are AFAIK no longer supported. Use the correct #include statements instead, a decent C++ book should tell you what they are.
Hint: forget the .h

I have already changed from
#include<fstream.h>
to
#include<fstream>
using namespace std;
still it gives following errors ...

c:\program files\microsoft visual studio 9.0\vc\include\iosfwd(574) : error C2146: syntax error : missing ';' before identifier '_Char_traits_cat'
1>c:\program files\microsoft visual studio 9.0\vc\include\iosfwd(574) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft visual studio 9.0\vc\include\iosfwd(574) : error C2888: '_Char_traits_category<_Traits>::_Secure_char_traits _Secure_char_traits' : symbol cannot be defined within namespace 'std'
1>c:\program files\microsoft visual studio 9.0\vc\include\iosfwd(574) : fatal error C1903: unable to recover from previous error(s); stopping compilation

see reply #1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.