title: Avoid unresolved externals when implementing singleton pattern
body: <p>Consider following <a href="https://stackoverflow.com/help/minimal-reproducible-example">MRE</a>:</p>
  <pre class="lang-cpp prettyprint-override"><code>class Segment
  {
  public:
      void update();
  };
  
  class Singleton
  {
      Singleton();
  public:
      static Singleton&amp; get_instance();
      void complete();
  };
  
  void Segment::update()
  {
      Singleton::get_instance().complete();
  }
  
  Singleton&amp; Singleton::get_instance()
  {
      static Singleton instance;
      return instance;
  }
  void Singleton::complete()
  {}
  
  int main()
  {
      return 0;
  }
  </code></pre>
  <p>When I compile the code under standard Debug configuration in VS2019, I get a linker error about unresolved external for function <code>get_instance()</code>.</p>
  <p><em>Full error description</em></p>
  <pre class="lang-none prettyprint-override"><code>LNK1120 1 unresolved externals
  LNK2019 unresolved external symbol
  &quot;private: __cdecl Singleton::Singleton(void)&quot;
  (??0Singleton@@AEAA@XZ) referenced in function
  &quot;public: static class Singleton &amp; __cdecl Singleton::get_instance(void)&quot;
  (?get_instance@Singleton@@SAAEAV1@XZ)
  </code></pre>
  <p>I declared the classes first, then I implemented all the methods so what's wrong?</p>