Code: Select all
//main.h
class Simple : public wxFrame
{
public:
Simple(const wxString& title);
void AddSymbol(wxCommandEvent& event);
protected:
DECLARE_EVENT_TABLE()
};
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
Code: Select all
//main.cpp
#include "main.h"
#include "AddDialog.h"
Simple::Simple(const wxString& title) : wxFrame(NULL, -1, title, wxDefaultPosition, wxSize(600, 400))
{
AddButton = new wxButton( this, 1002, wxT("Add Symbol"), wxDefaultPosition, wxDefaultSize, 0 );
}
void Simple::AddSymbol(wxCommandEvent& WXUNUSED(event))
{
AddDialog *dialog = new AddDialog(this);
dialog -> Show(true);
}
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
Simple *simple = new Simple(wxT("Stock Ticker"));
simple->Show(true);
return true;
}
BEGIN_EVENT_TABLE(Simple, wxFrame)
EVT_BUTTON(1002, Simple::AddSymbol)
END_EVENT_TABLE()
Code: Select all
//AddDialog.h
#include <wx/wx.h>
#include <wx/dialog.h>
#include "AddDialog.cpp"
class AddDialog : public wxDialog
{
public:
AddDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Add Stock Symbol"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
~AddDialog();
};
Code: Select all
//AddDialog.cpp
#include <wx/wx.h>
AddDialog::AddDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
//
}
AddDialog::~AddDialog()
{
}
I cannot for the life of me figure out why it can't see AddDialog. It was included in main.cpp, it should see the class, right?!In file included from source/AddDialog.h:6:0,
from source/main.cpp:2:
source/AddDialog.cpp:3:1: error: ‘AddDialog’ does not name a type
In file included from source/AddDialog.h:6:0,
from source/main.cpp:2:
source/AddDialog.cpp:28:1: error: ‘AddDialog’ does not name a type
FlyingIsFun1217