<分区>
这是我的“程序”:
#include <string>
#include <ext/hash_map>
int main()
{
std::hash_map<std::string, int> myMap;
}
我正尝试在 Red Hat 上用 g++ 编译它。有人可以解释为什么编译器会提示:
错误:“hash_map”不是“std”的成员
<分区>
这是我的“程序”:
#include <string>
#include <ext/hash_map>
int main()
{
std::hash_map<std::string, int> myMap;
}
我正尝试在 Red Hat 上用 g++ 编译它。有人可以解释为什么编译器会提示:
错误:“hash_map”不是“std”的成员
最佳答案
hash_map 在不同的命名空间中,即 __gnu_cxx::hash_map
。
HashMap 的更新版本是 std::tr1::unordered_map
或自 c++11 std::unordered_map
关于c++ - 错误 : 'hash_map' is not a member of 'std' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18833818/