complie question

  • Thread starter howarddevore2003
  • Start date
H

howarddevore2003

hi when i try to compile this:

#include <iostream.h>

int main()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "the value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}

...with g++ i get the following:

In file included from /usr/include/c++/3.3/backward/iostream.h:31,
from returnInt.cpp:1:
/usr/include/c++/3.3/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.

my question here is this: is iostream.h depracated? Any thoughts on
this code you'd like to share?
thanks in advance for any replies! :)

howard
 
J

John Harrison

hi when i try to compile this:

#include <iostream.h>

int main()
{
int i;
cout << "Please enter an integer value: ";
cin >> i;
cout << "the value you entered is " << i;
cout << " and its double is " << i*2 << ".\n";
return 0;
}

..with g++ i get the following:

In file included from /usr/include/c++/3.3/backward/iostream.h:31,
from returnInt.cpp:1:
/usr/include/c++/3.3/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.

my question here is this: is iostream.h depracated? Any thoughts on
this code you'd like to share?
thanks in advance for any replies! :)

howard

iostream.h is deprecated by g++, it is not and never has been a standard
C++ header.

Code is fine, but to avoid the warning use

#include <iostream>
using namespace std;

instead of

#include <iostream.h>

Note the lack of a .h in the correct name of the header file.

john
 
H

howarddevore2003

Thanks John, thats really helped me out.
It works just fine now :)

howard
 
H

howarddevore2003

Thanks John, thats really helped me out.
It works just fine now :)

howard
 
V

Victor Bazarov

John said:
[..]
#include <iostream>
using namespace std;

instead of

#include <iostream.h>

Note the lack of a .h in the correct name of the header file.

It's not really 'the lack'. It's just 'absence'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top