title: Weird linker error with static std::map
body: <p>Why do I get linker error when I try to compile this in Visual Studio 2008</p>
  
  <pre><code>#include &lt;stdafx.h&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;string&gt;
  
  class MyClass
  {
  public:
   MyClass () { };
   virtual ~MyClass() {};
  
   static std::string niceString (std::map&lt;int, int&gt; mappp) { _myMap = mappp; return "nice string"; };
  
  private:
   static std::map&lt;int, int&gt; getMap ( ) { return _myMap; };
  
   static std::map&lt;int, int&gt; _myMap;
  }; 
  
  int main(){
  
   std::map&lt;int, int&gt; mappp;
  
   mappp[1] = 1;
  
   std::cout &lt;&lt; MyClass::niceString(mappp);
  
  }
  </code></pre>
  
  <p>error is:</p>
  
  <pre><code>Error 1 error LNK2001: unresolved external symbol "private: static class std::map&lt;int,int,struct std::less&lt;int&gt;,class std::allocator&lt;struct std::pair&lt;int const ,int&gt; &gt; &gt; MyClass::_myMap" (?_myMap@MyClass@@0V?$map@HHU?$less@H@std@@V?$allocator@U?$pair@$$CBHH@std@@@2@@std@@A) test22.obj test22
  </code></pre>