Deprecated Header warning (C++)

Deprecated Header warning (C++)

本文关键字:C++ warning Header Deprecated      更新时间:2023-10-16

我一直收到已弃用的标头警告:

#ifdef __DEPRECATED
#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.
#endif

然而,我没有看到我的项目调用任何不赞成的头文件(包括我的库调用的头文件)。这些是我正在加载的标题(或者,至少是我看到的标题):iostream math.h assert.h fstream vector time.h

在第17.4.1.2 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf节中,只有应该使用的标头列表。

1)是否有一个已弃用的列表?

2)任何关于如何摆脱预处理器的想法哪一个是他不喜欢的确切头?

干杯!

来自C世界的标头必须以c作为前缀,而不是后置。
这意味着您需要包含cmath, cassertctime

在这种情况下,只有头文件的名称是不可取的,而不是内容。

注意:您可以通过在您链接到的文档中匹配它们的名称来推断哪些标头受到这种弃用。

显然,这只适用于标准头文件。例如,unistd.h将始终是unistd.h