Something's wrong with recent g++ include files
Phil Edwards
pedwards@disaster.jaj.com
Fri Dec 1 11:21:00 GMT 2000
On Fri, Dec 01, 2000 at 01:39:02PM -0500, David Ronis wrote:
>
> -------------------------------------------------------
> #include <iostream.h>
> int main(){ cout << "Hello World!" << endl; return 0;}
> -------------------------------------------------------
[....]
> foo.c++:1:22: iostream.h: No such file or directory
This code is, strictly speaking, incorrect. Welcome to namespaces and
the new C++. :-)
> Sure enough, /usr/include/g++-v3 contains iostream, but not iostream.h
> (or most other .h files), moreover when I change the include to
> iostream (which can't be correct) I still get an error that cout and
> endl aren't defined. The preprocessed file for this case is attached.
>
> This used to work a snapshot or so ago.
The snapshots have been non-compliant up until a snapshot or so ago. :-)
ISO Standard C++ only defines an <iostream> header, not an <iostream.h>.
Please see http://gcc.gnu.org/libstdc++/17_intro/howto.html for more.
If you absolutely must use <iostream.h> -- and the classes in there are
very old, not just <iostream> with a 'using std::foo', either -- then
you must add -I/wherever/you/installed/gcc/include/g++-v3/backward to the
command line. Older headers are installed in the 'backward' subdirectory.
Luck++;
Phil
--
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.
More information about the Gcc-bugs
mailing list