title: How do I Forward Declare a Property in C++/CLI?
body: <p>I have a class in C++/CLI that I'd like to give a property. I want to declare the property in a header file and then implement that property in a .cpp file. </p>
  
  <p>Here's the header:</p>
  
  <pre><code>public ref class Dude
  {
      static property Dude^ instance
      {
          Dude^ get();    
      }
  }
  </code></pre>
  
  <p>If I declare the header file and don't put anything in the cpp, i get the following error:</p>
  
  <pre><code>1&gt;Dude.obj : error LNK2020: unresolved token (06000001) Test.Dude::get_instance
  </code></pre>
  
  <p>From this I concluded that I should implement the property as </p>
  
  <pre><code>  static Lock myInstanceLock;
  
     Dude^ Dude::get_instance()
     {
  
         if(myInstance == nullptr)
         {
             myInstanceLock.lock();
             if(myInstance == nullptr)
             {
                 myInstance = gcnew Dude();
             }
             myInstanceLock.unlock();             
         }
         return myInstance;
     }
  </code></pre>
  
  <p>However, when I compile this code, I get a bunch of errors. The first error (The others are a result of the first one) is:</p>
  
  <pre><code>1&gt;.\Dude.cpp(13) : error C2039: 'get_instance' : is not a member of 'Test::Dude'
  </code></pre>
  
  <p>Can anyone shed some light on this issue?</p>