【问题标题】:error: 'hash_map' is not a member of 'std' [duplicate]错误:“hash_map”不是“std”的成员[重复]
【发布时间】: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'

【问题讨论】:

标签: c++ g++ hashmap


【解决方案1】:

其中的 hash_map 位于不同的命名空间中,即__gnu_cxx::hash_map。 较新版本的哈希映射是std::tr1::unordered_map 或c++11 以后的std::unordered_map

【讨论】:

    猜你喜欢
    • 2021-08-26
    • 2014-04-06
    • 2014-11-23
    • 2020-02-02
    • 2014-08-27
    • 2021-09-07
    • 2013-08-07
    • 2017-05-20
    • 1970-01-01
    相关资源
    最近更新 更多