LinuxQuestions.org
Help answer threads with 0 replies.
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 09-27-2004, 07:47 PM   #1
jdruin
Member
 
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:

Code:
// /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
Quote:
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 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.

I did a
Code:
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, 07:53 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
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, 07:56 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,868

Rep: Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358Reputation: 6358
Futhermore add

using namespace std;

like :

#include <iostream>
#include <list>

using namespace std;

int main ()
{
....
}
 
Old 09-28-2004, 07:31 AM   #4
jdruin
Member
 
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.
 
  


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration