Where is this backward_warning.h #warning coming from?

Without looking through every single source file in my XCode project, is there a way to find out which #include is triggering the following 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 <iostream> instead of the deprecated header 
<iostream.h>. To disable this warning use -Wno-deprecated.

Clicking on the error in XCode just opens the backward_warning.h file, which is totally useless.

  • GCC 4.0, 4.2 and LLVM ABI Compatibility
  • Is it possible to compile a newer version of LLVM and use it with Xcode?
  • Getting “A valid signing identity matching this profile could not be found in your keychain” warning
  • Access localhost on Mac from XCode? Phonegap communicating with Ajax to a local Rails app
  • Swap rootViewController with animation?
  • Potential leak of an object stored into
  • I know what the warning means, I know how to fix it (when I see the file in question and can look at its #includes)… but I just don’t know how to find the file causing the error!

    3 Solutions Collect From Internet About “Where is this backward_warning.h #warning coming from?”

    Use the -H option to GCC – that will list the header files that are being included (along with a nesting indication so you can see what file is including which header).

    With -H the error will be placed in the output stream clearly showing how the compiler got to backward_warning.h.

    For example, when I include hash_map, I’d see:

    mikeb@ubuntu:~$ g++  -H -c test.cpp
    . /usr/include/c++/4.4/backward/hash_map
    .. /usr/include/c++/4.4/backward/backward_warning.h
    In file included from /usr/include/c++/4.4/backward/hash_map:60,
                     from test.cpp:3:
    /usr/include/c++/4.4/backward/backward_warning.h:28: warning: #warning This file
    includes at least one deprecated or antiquated header which may be removed without
    further notice at a future date. Please use a non-deprecated interface with equivalent 
    functionality instead. For a listing of replacement headers and interfaces, consult 
    the file backward_warning.h. To disable this warning use -Wno-deprecated.
    
    ... a bunch of snipped output ...
    

    As an aside, /showIncludes performs the same function in MSVC.

    As you stated, the file /usr/include/c++/4.2.1/backward/backward_warning.h
    contains the text you quote. The headers which include backward_warning.h are:

    • /usr/include/c++/4.2.1/backward/algo.h
    • /usr/include/c++/4.2.1/backward/algobase.h
    • /usr/include/c++/4.2.1/backward/alloc.h
    • /usr/include/c++/4.2.1/backward/bvector.h
    • /usr/include/c++/4.2.1/backward/complex.h
    • /usr/include/c++/4.2.1/backward/defalloc.h
    • /usr/include/c++/4.2.1/backward/deque.h
    • /usr/include/c++/4.2.1/backward/fstream.h
    • /usr/include/c++/4.2.1/backward/function.h
    • /usr/include/c++/4.2.1/backward/hash_map.h
    • /usr/include/c++/4.2.1/backward/hash_set.h
    • /usr/include/c++/4.2.1/backward/hashtable.h
    • /usr/include/c++/4.2.1/backward/heap.h
    • /usr/include/c++/4.2.1/backward/iomanip.h
    • /usr/include/c++/4.2.1/backward/iostream.h
    • /usr/include/c++/4.2.1/backward/istream.h
    • /usr/include/c++/4.2.1/backward/iterator.h
    • /usr/include/c++/4.2.1/backward/list.h
    • /usr/include/c++/4.2.1/backward/map.h
    • /usr/include/c++/4.2.1/backward/multimap.h
    • /usr/include/c++/4.2.1/backward/multiset.h
    • /usr/include/c++/4.2.1/backward/new.h
    • /usr/include/c++/4.2.1/backward/ostream.h
    • /usr/include/c++/4.2.1/backward/pair.h
    • /usr/include/c++/4.2.1/backward/queue.h
    • /usr/include/c++/4.2.1/backward/rope.h
    • /usr/include/c++/4.2.1/backward/set.h
    • /usr/include/c++/4.2.1/backward/slist.h
    • /usr/include/c++/4.2.1/backward/stack.h
    • /usr/include/c++/4.2.1/backward/stream.h
    • /usr/include/c++/4.2.1/backward/streambuf.h
    • /usr/include/c++/4.2.1/backward/strstream
    • /usr/include/c++/4.2.1/backward/tempbuf.h
    • /usr/include/c++/4.2.1/backward/tree.h
    • /usr/include/c++/4.2.1/backward/vector.h

    Therefore, the code you are compiling must be including a header such as:

    #include <vector.h>
    

    instead of the preferred:

    #include <vector>
    

    And the compiler is getting fussy about it. The fix is to find the code which includes the pre-standard header and update it to use the standard header.

    (You get similar warnings about deprecated functions if you compile git – the functions are the SHA1 functions from OpenSSL. It is a nuisance, to be polite about it.)

    You have an old style header somewhere.

    something like this

    IE:

    #include <iostream.h>  //instead of <iostream>
    #include <stdlib.h>    //instead of <cstdlib>
    #include <stdio.h>    //instead of <cstdio>
    

    if it is included from a library then I think you are SOL, I personally wouldn’t rummage through a library to get it to work you will have to up date them to use namespaces. and other such.