Matthew Miller wrote:
> Coert Waagmeester wrote:
> in fact all of this ...
>> I have an eBook from SAMS Teach yourself C++ in 21 days
>> When I compiled their Hello World example:
>>
>> 1: #include <iostream.h>
>> 2:
>> 3: int main()
>> 4: {
>> 5: cout << "Hello World!\n";
>> 6: return 0;
>> 7: }
>>
>> g++ came back with:
>> In file included from /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/backward/iostream.h:31,from hello.cpp:1:
>> /usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning:
>> #warning Thisfile 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>. To
>> disable this warning use -Wno-deprecated.
> ... is *exactly* that issue -- iostream.h is the older, more-C-like
> header file, and instead, you want the one called just iostream, with > no extension.
The OP will probably be interested to know also that the example as written won't compile if you simply substitute <iostream> for <iostream.h>, for the same (Object orientated) reason. In <iostream> 'cout' etc. live under the std namespace, so either 'cout' becomes 'std::cout' or you first expose cout using: #include <iostream> using std::cout;
Or expose the entire std namespace: #include <iostream> using namespace std; (This one is useful because lots of the standard C++ functions and classes like string live under std::)
-- imalone