title: Visual C++ - Call a function from a button click method
body: <p>I created a Visual C++ project, and made a button in the form. Visual Studio generates this method for a button click event:</p>
  
  <pre><code>private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  }
  </code></pre>
  
  <p>This code is in the Form1.h file, no problems for now. However, if I try to call a function, in the event method, using other classes, like std::cout (doesn't matter if I define it in the Form1.h file or I #include it from another file), the compiler gives me an error (C2079).</p>
  
  <p>Why does this happen? Please be patient as I am a total noob in Windows GUI programming, thanks in advance to whoever can help.</p>