Undefined reference when using singleton class
<p>I have following test application for singleton class : </p>

<pre><code>class my_singleton {
   private :
      my_singleton();
   public :
      static my_singleton&amp; getinstance() {
         static my_singleton instance;
         return instance;
      }
    void demo() {
       std::cout &lt;&lt; "demo !!!!" &lt;&lt; std::endl;
    }
};

int main(int argc, char* argv[]) {
   my_singleton::getinstance().demo();
}
</code></pre>

<p>When i compile the same i get : </p>

<p>undefined reference to `my_singleton::my_singleton()'</p>