LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
Search this Thread
Old 02-03-2003, 07:34 PM   #1
linuxlah
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: Reputation: 30
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>.....
 
Old 02-03-2003, 11:46 PM   #2
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
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;
}
 
Old 02-04-2003, 12:26 AM   #3
linuxlah
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: Reputation: 30
cool. It seems like we need to localize the std in order to use the <iostream> only. Thanks.
 
Old 02-04-2003, 02:13 AM   #4
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
That's actually the good thing about gcc/g++ is that it recognizes changes in Standard C++. The .h extension is deprecated.
 
Old 02-04-2003, 05:29 AM   #5
sathyan
LQ Newbie
 
Registered: Feb 2003
Location: India
Distribution: Red Hat 9
Posts: 24

Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
obsolete binding?? lmvent Programming 2 12-02-2010 07:15 PM
Obsolete version required... andrei_t Fedora 10 07-08-2005 05:19 AM
Question about /dev being obsolete. dr_zayus69 Linux - Hardware 1 05-30-2005 05:41 AM
M$ Doz obsolete? witeshark General 11 02-07-2004 06:45 PM
Is Microsoft Obsolete? GtkUser General 24 07-24-2003 07:34 PM


All times are GMT -5. The time now is 06:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration