Mailinglist Archive: opensuse-programming (96 mails)

< Previous Next >
Re: [suse-programming-e] Undepricated gcc Hello World?
  • From: Derek Fountain <derekfountain@xxxxxxxxxxx>
  • Date: Sun, 30 Mar 2003 22:34:35 +0800
  • Message-id: <200303302234.35941.derekfountain@xxxxxxxxxxx>
> > #include <iostream.h>
> >
> > int main()
> > {
> > cout << "Hello World!\n";
> > return 0;
> > }
> Perhaps you have deprication messages turned off, or you don't care about
> them. I understand this will compile. I just want to know what Stallman
> et al think I /should/ be doing.

If you're working with a language as complex as C++, and you really want the
details, you need a copy of the standard. It costs money, and isn't free to
distribute, but the GCC coders bought a copy and worked to it. If you want to
know what Stallman et al were thinking, read the standard. Then you'll know.
For most of us, a copy of the Stroustrup book is adequate.

> g++ hello.cpp
> In file included from /usr/include/g++/backward/iostream.h:31,
> from hello.cpp:1:
> /usr/include/g++/backward/backward_warning.h:32:2: warning: #warning This
> file includes at least one deprecated or antiquated header. Please consider
> using one of the 32 headers found in section of the C++ standard.
> Examples include substituting the <X> header for the <X.h> header for C++
> includes, or <sstream> instead of the deprecated header <strstream.h>. To
> disable this warning use -Wno-deprecated.

Which is clear enough, isn't it? The file "includes at least one deprecated or
antiquated header". The code contains "#include <iostream.h>", whereas the
standards compliant way to do it is "#include <iostream>". Have a look at
/usr/include/g++/backward/iostream.h, which is the file you're including.
Then have a look at /usr/include/g++/iostream which is the file you want (and
which the backwards compatible header file pulls in for you).

"...our desktop is falling behind stability-wise and feature wise to KDE
...when I went to Mexico in December to the facility where we launched gnome,
they had all switched to KDE3." - Miguel de Icaza, March 2003

< Previous Next >
Follow Ups