日期:2014-05-16  浏览次数:20613 次

c++编译总提示这个是什么意思??
[xxx@localhost   cpp]$   g++   main.cpp
In   file   included   from   /usr/include/c++/3.2.2/backward/iostream.h:31,form   main.cpp:1:
/usr/include/c++3.2.2/backward/backward_warning.h:32:2:   warning:   #warning   This   file   includes   at   least   one   deprecated   or   antiquated   header.Please   consider   using   one   of   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   <sstream>   instead   of   the   deprecated   header   <strstream.h> .   To   disable   this   warning   use   -Who-deprecated.
[xxx@localhost   cpp]$

这个Warning是什么意思,请前辈们指点一下

------解决方案--------------------
是不是用了#include <iostream.h> 这样的文件, 试试改为
#include <iostream>
using namespace std;
------解决方案--------------------
使用#include < iostream > ,得到的是置于名字空间std下的iostream库的元素,需要引入命名空间,即 "using namespace std; ";如果使用#include < iostream.h > ,得到的是置于全局空间的同样的元素。
在全局空间获取元素会导致名字冲突,而设计名字空间的初衷正是用来避免这种名字冲突的发生。
------解决方案--------------------
使用GCC选项-Who-deprecated就不会再有这个警告了