这是backward_warning.h在哪里来的? [英] Where is this backward_warning.h #warning coming from?

查看:1042
本文介绍了这是backward_warning.h在哪里来的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有看看我的XCode项目中的每一个源文件,有没有办法找出哪个#include触发以下警告?

  #warning此文件包含至少一个已弃用或过时的标题。 
请考虑使用
C ++标准的第17.4.1.2节中找到的32个标题之一。实例包括将< X>头的< X.h>
C ++的头包括,或者< iostream>而不是废弃的标头
< iostream.h> ;.要禁用此警告,请使用-Wno-deprecated。

单击XCode中的错误只是打开backward_warning.h文件, p>

我知道警告的含义,我知道如何解决它(当我看到问题的文件,可以看看它的#includes)...但我只是不' t知道如何查找导致错误的文件!

解决方案

使用 -H 选项到GCC - 将列出正在被包括的头文件(以及一个嵌套指示,所以你可以看到什么文件是包括哪个头)。



使用 -H ,错误会被放在输出流中,清楚地显示编译器如何获得 backward_warning.h 。 / p>

例如,当我包括 hash_map 时,我会看到:

  mikeb @ ubuntu:〜$ g ++ -H -c test.cpp 
。 /usr/include/c++/4.4/backward/hash_map
.. /usr/include/c++/4.4/backward/backward_warning.h
在包含在/usr/include/c++/4.4/backward的文件中/ hash_map:60,
从test.cpp:3:
/usr/include/c++/4.4/backward/backward_warning.h:28:warning:#warning此文件
至少包括一个已弃用或过时的标题,可以在未来日期进一步通知未删除
。请使用具有等效
功能的非过时的界面。有关替换头和接口的列表,请参阅
文件backward_warning.h。要禁用此警告,请使用-Wno-deprecated。

...一堆剪切输出...

aside, / showIncludes 在MSVC中执行相同的功能。


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.

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!

解决方案

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.

这篇关于这是backward_warning.h在哪里来的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆