By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,087 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

include problem

P: n/a
I am a newbie with C++ and unable to understand this warning/error
message :

localhost > g++ -Wall j++.cpp
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from j++.cpp:2:
/usr/include/c++/3.2.2/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
17.4.1.2 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.

The offending line is :
#include <iostream.h>

The compiler is GNU C/C++ version : 3.2.2.3
Host OS is : Mandrake Linux 9.1

All help welcome....
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
skumar escribió:
The offending line is :
#include <iostream.h>


It tell you that <iostream.h> is a pre-standard form, and you must use
<iostream> instead.

Find a more recent C++ book or tutorial than you have actually.

Regards.
Jul 19 '05 #2

P: n/a

"skumar" <s_*******@rediffmail.com> wrote in message news:a0**************************@posting.google.c om...
#include <iostream.h>

This header is not part of standard C++. It is for G++ an obsolete header. The standard
header is called <iostream>. This defines the stream stuff into the std namespace as well.
This means that in addtition to changing the header you must place explicitly qualify the
stuff from that header (std::cout for example) or bring then into the current context with
using directives (using std::cout or even using namespace std). Do not place using directives
in headers that you expect others to use. It's not nice to pollute their namespace. Stick
to the explicit qualification in headers.
Jul 19 '05 #3

P: n/a
"skumar" <s_*******@rediffmail.com> wrote in message
news:a0**************************@posting.google.c om...
I am a newbie with C++ and unable to understand this warning/error
message :

localhost > g++ -Wall j++.cpp
In file included from /usr/include/c++/3.2.2/backward/iostream.h:31,
from j++.cpp:2:
/usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header.
This is true. <iostream.h> is a header from before
C++ was standardized. So it's 'antiquated' rather
than 'deprecated'. 'Deprecated' means it's still
officially standard, but that a more 'modern' form
is preferred.

In standard C++, none of the standard headers (except
for some C library headers which are deprecated), have
a ".h" in their names. The *only* valid standard header
for declaring the standard stream objects is <iostream>.
No. '.h'.

All the identifiers in the C++ library (except macros
and C identifiers declared in the deprecated '.h' headers)
are declared inside namespace 'std', so you need to qualify them
when using them (with 'using' directives or declarations,
or explicit qualification).
Please consider using one of the 32 headers found in section
17.4.1.2 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>.
This is what you need to do.
Change <iostream.h> to <iostream>, and get the
identifiers from namespace 'std'.

BTW That last part of the warning message is technically
incorrect. <strstream.h> is not and never has been part
of standard C++, so it cannot be 'deprecated'.

Many implemenations provide prestandard headers such
as <iostream.h> for 'backward compatibility' do that
legacy code can still be used. New code should use
the standard headers.

To disable this warning use
-Wno-deprecated.

The offending line is :
#include <iostream.h>

The compiler is GNU C/C++ version : 3.2.2.3
Host OS is : Mandrake Linux 9.1

All help welcome....


#include <iostream>
using namespace std; /* only use this form for simple */
/* or example programs */
int main()
{
cout << "Hello standard C++\n";
return 0;
}

More about this issue can be seen in a good (modern)
C++ text, and in the C++ FAQ:
http://www.parashift.com/c++-faq-lite/
See item 27.4 (But read the whole FAQ, you'll
be glad you did. :-) )

-Mike
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.