title: How to use a separate .cpp file for my event function definitions in windows forms?
body: <p>I'm having trouble defining my C++ event functions in windows forms. </p>
  
  <p>I want to define my event functions (example: button click) in a separate .cpp file instead of doing all the function definitions in the windows forms .h file that's already full of generated code for the windows forms GUI.</p>
  
  <p>I tried doing this, 
  Declaration inside the Form1.h class:</p>
  
  <pre><code>private: System::Void ganttBar1_Paint
  (System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e);
  </code></pre>
  
  <p>And this is the definition inside Form1.cpp class:</p>
  
  <pre><code>#include "Form1.h"
  
  System::Void Form1::ganttBar1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e)
  {
      // Definition
  }
  </code></pre>
  
  <p>When I do this i get compiler errors in the .cpp file saying that it's not a class or namespace name. </p>
  
  <p><strong>What can i do to get the definitions and declarations of the event functions in seprate files?</strong></p>
  
  <p>Am I just being stupid and missing something here or do i have to do these things in another way than the C++ standard?</p>