C++ error: 'unordered_map' does not name a type

前端 未结 3 934
感动是毒
感动是毒 2021-01-08 00:41

I am doing everything correctly as far as I can tell and I have gotten the error message:

error: \'unordered_map\' does not name a type
error: \'mymap\' does         


        
3条回答
  •  忘掉有多难
    2021-01-08 00:48

    Compile with g++ -std=c++11 (my gcc version is gcc 4.7.2) AND

    #include 
    #include 
    
    using namespace std;
    
    //global variable
    unordered_map mymap;
    
    int main() {
      mymap.reserve(7000); // <-- try putting it here
      return 0;
    }
    

提交回复
热议问题