compile error. stl/backward_warning.h解决方法
compile error. stl/backward_warning.h
我写了一个简单的hashmap,想和stl的hash_map比较一下
STL都是刚从网上下载的:
http://www.sgi.com/tech/stl/download.html
结果编译的时候(g++)出现下面的错误:
In file included from /home/.../hashmap/stl/iostream.h:31:0,
from /home/.../hashmap/stl/stl_algobase.h:57,
from /home/.../hashmap/stl/stl_hashtable.h:37,
from /home/.../hashmap/stl/hash_map.h:31,
from /home/.../hashmap/hashtest.cc:2:
/home/.../hashmap/stl/backward_warning.h:32:2: 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.
hash_map.h的第2行就是简单的文件包含: #include "hash_map.h"
这个错误表示什么意思?怎么修改?
先谢谢各位啦。
------解决方案--------------------
你可以编译的时候加 -Wno-deprecated 选项,或者
#include <unordered_map>
并用
std::unordered_map
代替
hash_map
我写了一个简单的hashmap,想和stl的hash_map比较一下
STL都是刚从网上下载的:
http://www.sgi.com/tech/stl/download.html
结果编译的时候(g++)出现下面的错误:
In file included from /home/.../hashmap/stl/iostream.h:31:0,
from /home/.../hashmap/stl/stl_algobase.h:57,
from /home/.../hashmap/stl/stl_hashtable.h:37,
from /home/.../hashmap/stl/hash_map.h:31,
from /home/.../hashmap/hashtest.cc:2:
/home/.../hashmap/stl/backward_warning.h:32:2: 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.
hash_map.h的第2行就是简单的文件包含: #include "hash_map.h"
这个错误表示什么意思?怎么修改?
先谢谢各位啦。
------解决方案--------------------
你可以编译的时候加 -Wno-deprecated 选项,或者
#include <unordered_map>
并用
std::unordered_map
代替
hash_map