C++ error: 'unordered_map' does not name a type
11:52 31 Mar 2013

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 not name a type

In my code, I have:

#include 

using namespace std;

//global variable
unordered_map mymap;
mymap.reserve(7000);

void main {
  return;
}

I don't see what can be missing here....

EDIT: when I update my declaration to

std::tr1::unordered_map mymap;

I an able to eliminate the first error, but when I try to reserve, I still get the second error message.

EDIT2: As pointed out below, reserve must go into main and I need to compile with flag

-std=c++0x

However, there still appear to be errors related to unordered_map, namely:

error: 'class std::tr1::unordered_map, int>' has no member named 'reserve'
c++ types unordered-map