title: Why are variables - marked <<<<<< undefined
body: <p>I am new to C++ and wxWidgets and trying to follow a basic example which appears to run with the exception of the <code>OnButtonClicked</code> marked by &lt;&lt;&lt;&lt;&lt;&lt;&lt;</p>
  <p>The variables are undefined at the Build stage (if I comment out both lines the code will run)</p>
  <p>Is there something wrong with the definition of the variable m_list1 and m_txt1?</p>
  <pre><code>    //===================cMain.h ===========
  #pragma once    //see 22:450
  #include &quot;wx/wx.h&quot;
  
  class cMain : public wxFrame
  {
  public:
      cMain();
      ~cMain();
  public:
      wxButton *m_btn1 = nullptr;  //25:48
      wxTextCtrl *m_txt1 = nullptr;
      wxListBox *m_list1 = nullptr;
  
      void OnButtonClicked(wxCommandEvent &amp;evt);  //27:30
      wxDECLARE_EVENT_TABLE();  // 27:34
  };
      //===================cMain.cpp ===========
  #include &quot;cMain.h&quot;
  
  wxBEGIN_EVENT_TABLE(cMain,wxFrame)  // 28:00
      //EVT_BUTTON(10001,OnButtonClicked) //28:33
  wxEND_EVENT_TABLE()
  
  cMain::cMain() : wxFrame(nullptr, wxID_ANY, &quot;Peter's First WxWidget Code &quot;,wxPoint(30,30),wxSize(800,600))
  {
      m_btn1 = new wxButton(this, 10001, &quot;Click Me&quot;, wxPoint(10, 10), wxSize(150, 50));   //28:36
      m_txt1=new wxTextCtrl(this, wxID_ANY, &quot;&quot;, wxPoint(10, 70), wxSize(300, 30));
      m_list1=new wxListBox(this, wxID_ANY,  wxPoint(10, 110), wxSize(300,300));
  }
  
  
  cMain::~cMain()
  {
  }
  
  void OnButtonClicked(wxCommandEvent &amp;evt)
  {
      //m_list1-&gt;AppendString(m_txt1-&gt;GetValue());        //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
      m_list1-&gt;AppendString(&quot;ONE&quot;);                       //&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
      evt.Skip();     //29.24
  }
  
      //===================cApp.h ===========
  #pragma once                            //24:09
  
  #include &quot;wx/wx.h&quot;
  #include &quot;cMain.h&quot;
  
  class cApp : public wxApp
  {
  public:
      cApp();
      ~cApp();
  
  private:
      cMain* m_frame1 = nullptr;
  
  public:
      virtual bool OnInit();
  };
      //===================cApp.cpp ===========
  
  #include &quot;cApp.h&quot;          // 24:19
  wxIMPLEMENT_APP(cApp);
  cApp::cApp()
  {
  }
  
  cApp::~cApp()
  {
  }
  bool cApp::OnInit()
  {
      m_frame1 = new cMain();
      m_frame1-&gt;Show();
      return true;
  }
  </code></pre>
  <p>Any help appreciated</p>