code not compiling w/ "deprecated headers"?

This is a discussion on code not compiling w/ "deprecated headers"? within the C++ Programming forums, part of the General Programming Boards category; Hello, I downloaded some image processing code that has been used successfully by others. I am working on a Linux ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    1

    Question code not compiling w/ "deprecated headers"?

    Hello, I downloaded some image processing code that has been used successfully by others. I am working on a Linux network in a Unix command window. When I try to compile it I get a warning that some of the headers are "deprecated" and this is followed by a whole host of errors. Can anyone get me started on figuring out how to fix or get around this problem? Are the fact that the headers are "deprecated" related to the compilation errors?

    I've included the warning and a few of the many error messages.

    Code:
    steve:mhoffman% g++ encode.cc
    In file included from /usr/local/include/c++/3.3.1/backward/iostream.h:31,
                     from encode.cc:19:
    /usr/local/include/c++/3.3.1/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 secti
    on 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 us
    e -Wno-deprecated.
    In file included from coder.hh:37,
                     from coeffset.hh:36,
                     from encode.cc:22:
    BitIO.h: In member function `int BitIn::input_bit()':
    BitIO.h:37: error: no matching function for call to `std::basic_istream<char, 
       std::char_traits<char> >::get(unsigned char&)'
    /usr/local/include/c++/3.3.1/bits/istream.tcc:514: error: candidates are: 
       typename _Traits::int_type std::basic_istream<_CharT, _Traits>::get() [with 
       _CharT = char, _Traits = std::char_traits<char>]
    /usr/local/include/c++/3.3.1/bits/istream.tcc:546: error:                 
       std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, 
       _Traits>::get(_CharT&) [with _CharT = char, _Traits = 
       std::char_traits<char>]
    /usr/local/include/c++/3.3.1/bits/istream.tcc:580: error:                 
       std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, 
       _Traits>::get(_CharT*, int, _CharT) [with _CharT = char, _Traits = 
       std::char_traits<char>]
    Thank you,
    kilgore
    Last edited by kilgorehoffman; 12-30-2004 at 08:05 PM. Reason: grammar

  2. #2
    Arggggh DeepFyre's Avatar
    Join Date
    Sep 2004
    Posts
    227
    switch iostream.h to iostream

    so:

    Code:
    <iostream.h>
    should be

    Code:
    <iostream>
    deprecated headers are headers that were used before and have now been updated, as far as i know
    Keyboard Not Found! Press any key to continue. . .

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    you'll also need to tell the compiler what namespace you're using. for now you can do that by typing this:
    Code:
    #include<iostream>
    using namespace std;
    that's not the best way to do it, but it is the easiest. IMO, the best way to do it is like this:

    Code:
    #include<iostream>
    using std::cout;
    using std::cin;
    using std::endl;
    using std::flush;
    //etc.
    finally, a third way that alot of people think is the best:
    Code:
    #include<iostream>
    
    int main()
    {
        std::cout<<"hello world"<<std::endl;
        return 0;
    }
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    Or since it's someone elses code (and therefore someone elses problem), you could

    a) inform them their code needs updating (send them the error messages).
    b) read the error message and deduce that this command may be worth trying.
    Code:
    % g++ -Wno-deprecated encode.cc
    Then see what (if anything) remains to be solved.

  5. #5
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    >deprecated headers are headers that were used before and have now been updated, as far as i know
    Deprecated headers are headers that were part of a previous version of the standard but may be removed in a future revision. They're still supported, but not recommended. Of course, for headers such as iostream.h that never were a part of the C++ standard, they can be removed from an implementation without warning and it serves you right for not writing standard compliant code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-01-2006, 02:07 AM
  2. compiling c code
    By MadCow257 in forum C++ Programming
    Replies: 2
    Last Post: 02-16-2006, 08:26 AM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 12:33 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-15-2002, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21