Deprecated Header warning (C++)
I keep receiving the deprecated header warning:
#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++ stand开发者_如何学JAVAard. 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
However, I don't see any deprecated header called by my project (including the headers called by my libraries). These are the header I am loading (or, at least the ones that I am seeing): iostream
math.h
assert.h
fstream
vector
time.h
.
In section 17.4.1.2 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf there is only a list of the header one should use.
1) Is there somewhere a list of the deprecated ones?
2) Any idea on how to get out of the preprocessor which one is the exact header he doesn't like?
CHEERS!
The headers coming from the C world are to be prefixed with c
, and not postfixed.
That means you'll want to include cmath
, cassert
and ctime
.
In those cases, only the header name is subject to deprecation, not the contents.
Note: you can deduce which headers are subject to this kind of deprecation by matching their names in the document you link to.
Obviously, this only works for standard headers. For instance, unistd.h
will always be unistd.h
.
精彩评论