title: C++ shared_ptr based singletone what causes link error?
body: <p>So I try this code:</p>
  
  <pre><code>#ifndef TRANSMITTER_H
  #define TRANSMITTER_H
  class connector
  {   
  public:
      static boost::shared_ptr&lt;connector&gt; Instance(){
          if(!instance)
          {
              instance = boost::shared_ptr&lt;connector&gt;(new connector());
          }
          return instance;
      }
  private:
      connector(){}
      static boost::shared_ptr&lt;connector&gt; instance;
  };
  #endif //TRANSMITTER_H
  </code></pre>
  
  <p>But get link error:</p>
  
  <pre><code>Error   3   error LNK2001: unresolved external symbol "private: static class boost::shared_ptr&lt;class connector&gt; connector::instance" (?instance@connector@@0V?$shared_ptr@Vconnector@@@boost@@A)
  </code></pre>
  
  <p>What is wrong with shared_ptr I want to return? Shall I make it function scope static variable?</p>