title: Error "xxxx"does not name a type
body: <p>I encountered a problem when tried compiling the following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdio&gt;
  #include &lt;cstring&gt;
  #include &lt;algorithm&gt;
  #include &lt;map&gt;
  
  using namespace std;
  
  map&lt;char, int&gt; mapDial;
  
  mapDial['A'] = 2;
  
  int main()
  {
  
    cout &lt;&lt; mapDial['A'] &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p>The compiler gave me a error: 'mapDial' does not name a type error. I am new to c++ and really don't know what is going on here. Can anyone here help me to solve this? Thanks!!</p>