Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-03-2003, 08:34 PM
|
#1
|
Member
Registered: Jun 2002
Location: Batu Puteh, Malaysia
Distribution: (Mandrake 8.2) (Redhat 7.2,8.0,9.0) (Slackware 9.0,9.1)
Posts: 154
Rep:
|
What's up with iostream.h, is it obsolete?
when I woke up in the morning I usually will try to compile my hello world program( nice intro huh?). In my RH8 machine, it compile but it gave me backward warning like this..
/usr/include/c++/3.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.
It seems like iostream.h is obsolete. So I tried to remove the .h like the warning suggested, but it didn't work. My code can't recognize my "cout" when I remove the .h in my #include <iostream.h>.....
|
|
|
02-04-2003, 12:46 AM
|
#2
|
Member
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647
Rep:
|
Whenever you use the new standard C++ library without ".h", you have to put the "std::" infront throughout your code.
For example,
#include <iostream>
main() {
std::cout << "hello\n";
return 0;
}
If you don't want to put "std::" throughout the program, you can write the line "using namespace std;" just below your header file declaration.
For example,
#include <iostream>
using namespace std;
main() {
cout << "hello\n";
return 0;
}
|
|
|
02-04-2003, 01:26 AM
|
#3
|
Member
Registered: Jun 2002
Location: Batu Puteh, Malaysia
Distribution: (Mandrake 8.2) (Redhat 7.2,8.0,9.0) (Slackware 9.0,9.1)
Posts: 154
Original Poster
Rep:
|
cool. It seems like we need to localize the std in order to use the <iostream> only. Thanks.
|
|
|
02-04-2003, 03:13 AM
|
#4
|
Member
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637
Rep:
|
That's actually the good thing about gcc/g++ is that it recognizes changes in Standard C++. The .h extension is deprecated.
|
|
|
02-04-2003, 06:29 AM
|
#5
|
LQ Newbie
Registered: Feb 2003
Location: India
Distribution: Red Hat 9
Posts: 24
Rep:
|
I was fumbling with the same problem and when I poked around I found the old compiler named as g++296 sitting there which does not give the above warning. Any ways, now I know why the code is not working for the new compiler
|
|
|
All times are GMT -5. The time now is 05:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|