首页 > 解决方案 > 错误::unordered_map 在 int 之前未声明和预期的主表达式

问题描述

编译错误:: unordered_map 未在第 5 行声明

第 15 行中 int 之前的预期主表达式:: "unordered_map (int,int) hashmap;"

有时错误可以通过使用“使用命名空间标准”来解决,但在这里它仍然没有得到解决

#include <iostream>
#include <unordered_map>
using namespace std;

int help(int n, unordered_map <int,int> hashmap)
{
    return 0;
}


int main()
{
   int n;
   cin>>n;
  unordered_map <int,int> hashmap;
   cout<<help(n,hashmap)<<endl;
}

标签: c++declarationunordered-map

解决方案


推荐阅读