I'm trying to compile some C++ stuff on a Red Hat 8 machine. I get the error:
fstream.h: No such file or directory
so I did this:
locate fstream.h
and got this:
/usr/include/c++/3.2/backward/fstream.h
So it looks like I need to get /usr/include/c++/3.2/backward into the include path for gcc somehow. Can anyone remind me how that is done?
If this is your own code, pay close attention below. If not, read enough to understand why fstream.h is in .../3.2/backward/ and then figure out why .../3.2/backward/ isn't in the default include path (it should be).
The headers in .../3.2/backward/ are for backwards compatibility only. Eg. old gcc-2.* code that has #include <fstream.h> and others (see below) scattered liberally throughout and you don't want to change them, yet. You eventually should. If this is someone else's project and is packaged for gcc-3.*, I would consider this a bug (since even if it does compile, it's going to be shouting all over the place) and notify the package maintainer.
All the backwards compatible header does is shoves a warning and then includes the new version (from new name). The new names just drop the '.h'. So in my new gcc-3.* code I have:
#include <fstream>
not
#include <fstream.h>
This new naming is for all the standard OO libraries (*stream, and STL libraries such as vector, and so forth). For a complete list, just
find /usr/include/c++/3.2/backward/ -iname '*.h'
Any questions?
Jacob Fugal
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
