wrote:
> Hi,
>
> I was trying to compile the following bit of code:
>
> #include <iostream.h>
>
> main(){
>
> cout<<"Hello World!";
>
> }
>
> and I keep getting the following 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 <iostream> instead of
> the deprecated header <iostream.h>.
>
> I tried replacing iostream.h with iostream but then I get the error:
>
> test4.cpp:5: error: `cout' undeclared (first use this function)
>
> Can anyone please tell me why this is happening? I am using Dev-C++
> from Bloodshed Software to compile the code.
>
As David Harmon has already pointed out, <iostream.h> is not part of
the C++ standard, and never was part of the official standard.
Some compilers like the GNU compiler, will post a warning message about
the header being deprecated. But what they're referring to is that
it's deprecated to the implementation. That means the GNU compiler
itself may not support this non-standard header file in the feature.
It doesn't mean it's deprecated by the offical C++ standard.
If you use a header that is deprecated IAW official C++ standard, then
your code would still be portable, because any fully compliant C++
compiler would have to support it until the standard completely removed
it.
A header that never was part of the official C++ standard is not
portable, because no C++ compiler has to support it.
You'll find more compliant compilers like VC++ 7.1, don't support these
non-standard headers at all.