Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 09-27-2004, 08:47 PM   #1
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
C++ iostream - getting "deprecated header" error

I have a simple program I am using to explore typedef and structs more:

// /usr/include/c++/3.3/backward/iostream.h

#include <iostream.h>

typedef struct test_struct{
    int a;
    long b;
    char *c;
} *p_test;

int main(void){

    test_struct t;
    p_test p;
    p = &t;

    cout << "Size Of Struct: " << sizeof(test_struct) << " bytes" << std::endl;
    cout << "Address Of Struct: " << &t << std::endl;
    cout << "Size Of a: " << sizeof(t.a) << " bytes" << std::endl;
    cout << "Address Of a: " << &t.a << std::endl;    
    cout << "Size Of p: " << sizeof(p) << " bytes" << std::endl;
    cout << "Address Of p: " << &p << std::endl;    
    cout << "Contents Of p: " << p << std::endl;    

I compile with
g++ -o hello -g hello.c
Then I get this warning:

/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 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.

I did a
find / -name iostream.h
and the only path that came up was /usr/include/c++/3.3/backward/iostream.h which is the very iostream that I linked to. Where is the "correct" iostream? Is it in some package? How does this work? Thanks.
Old 09-27-2004, 08:53 PM   #2
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
Just do #include <iostream> instead of #include <iostream.h>. It's not a matter of using the incorrect header, it's a matter of including the header correctly
Old 09-27-2004, 08:56 PM   #3
Registered: Aug 2002
Posts: 13,453

Rep: Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105Reputation: 1105
Futhermore add

using namespace std;

like :

#include <iostream>
#include <list>

using namespace std;

int main ()
Old 09-28-2004, 08:31 AM   #4
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Original Poster
Rep: Reputation: 30
Thanks for the response. Could someone explain 'why' the declaration is incorrect and 'how' Linux utilizies these libraries. Also, is the iostream I found using the find function the one being used in the program? Where are Linux libraries usually stored. I am more interested in learning what is happening here rather than the syntax, although I appreciate the help on that too! Thanks.


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
Why "nslookup is deprecated" ? newbieA Linux - Networking 10 06-11-2015 05:17 PM
"mythtv-setup" giving "Session management error: Authentication Rejected" Mitchua Ubuntu 0 10-09-2005 05:32 PM
swat.cgi - "Error-Bad Header" br_sriram Linux - Software 0 09-18-2004 11:26 AM
Why is "only user" for Samba now deprecated? sorrodos Linux - Networking 0 07-08-2004 03:34 AM
"#include <iostream.h>" does not compile ambuj Linux - Software 7 01-28-2004 09:56 AM

All times are GMT -5. The time now is 05:21 PM.

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