【发布时间】:2013-09-20 22:41:20
【问题描述】:
这是我的“程序”:
#include <string>
#include <ext/hash_map>
int main()
{
std::hash_map<std::string, int> myMap;
}
我正在尝试在 Red Hat 上使用 g++ 编译它。有人可以解释为什么编译器会抱怨:
error: 'hash_map' is not a member of 'std'
【问题讨论】:
这是我的“程序”:
#include <string>
#include <ext/hash_map>
int main()
{
std::hash_map<std::string, int> myMap;
}
我正在尝试在 Red Hat 上使用 g++ 编译它。有人可以解释为什么编译器会抱怨:
error: 'hash_map' is not a member of 'std'
【问题讨论】:
其中的 hash_map 位于不同的命名空间中,即__gnu_cxx::hash_map。
较新版本的哈希映射是std::tr1::unordered_map 或c++11 以后的std::unordered_map
【讨论】: