Greetings,
» Any ideas why I can't include it?
It sometimes depends.
fstream is part of the C++ standard,
fstream.h isn't.
The difference between fstream and fstream.h
fstream is somewhat more restrictive than the older
fstream.h. One would possibly avoid problems by careful use of namespaces, but it would be a lot smarter to stick with one
or the other.
You should avoid using the *.h version as much as possible, because some implementations have bugs in their *.h version. Moreover, some of them support non-standard code that is not portable, and fail to support some of the standard code of the STL.
Furthermore, the *.h version puts everything in the global namespace. The extension-less version is more stable and it's more portable. It also places everything in the std namespace.
Conclusion
fstream.h is an old style method of including std C++ headers, and in opposite to
fstream you don't have to declare that you're using the std namespace.
It is sometimes recommended to use:
#include <fstream>
using namespace std;
Hope this helps,
-
Stack
Overflow