/*
* hworld.cpp
* Hello world sample by Robert Roebling
*/
#include "wx/wx.h"
class MyApp: public wxApp
{
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
enum
{
ID_Quit = 1,
ID_About,
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_About, "&About..." );
menuFile->AppendSeparator();
menuFile->Append( ID_Quit, "E&xit" );
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( "Welcome to wxWindows!" );
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox("This is a wxWindows Hello world sample",
"About Hello World", wxOK | wxICON_INFORMATION, this);
}
i686-apple-darwin8-g++-4.0.1: wx-config --libs: No such file or directory
i686-apple-darwin8-g++-4.0.1: wx-config --cxxflags: No such file or directory
Test.cpp:6:20: error: wx/wx.h: No such file or directory
Test.cpp:9: error: expected class-name before '{' token
Test.cpp:14: error: expected class-name before '{' token
Test.cpp:17: error: expected ',' or '...' before '&' token
Test.cpp:17: error: ISO C++ forbids declaration of 'wxString' with no type
Test.cpp:19: error: 'wxCommandEvent' has not been declared
Test.cpp:20: error: 'wxCommandEvent' has not been declared
Test.cpp:22: error: ISO C++ forbids declaration of 'DECLARE_EVENT_TABLE' with no type
Test.cpp:23: error: expected ';' before '}' token
Test.cpp:23: error: expected `;' before '}' token
Test.cpp:31: error: 'wxFrame' has not been declared
Test.cpp:32: error: expected constructor, destructor, or type conversion before 'EVT_MENU'
Test.cpp:46: error: expected ',' or '...' before '&' token
Test.cpp:46: error: ISO C++ forbids declaration of 'wxString' with no type
Test.cpp: In constructor 'MyFrame::MyFrame(int)':
Test.cpp:47: error: class 'MyFrame' does not have any field named 'wxFrame'
Test.cpp:47: error: 'wxFrame' was not declared in this scope
Test.cpp:47: error: expected primary-expression before ')' token
Test.cpp:47: error: 'title' was not declared in this scope
Test.cpp:47: error: 'pos' was not declared in this scope
Test.cpp:47: error: 'size' was not declared in this scope
Test.cpp:49: error: 'wxMenu' was not declared in this scope
Test.cpp:49: error: 'menuFile' was not declared in this scope
Test.cpp:49: error: expected type-specifier before 'wxMenu'
Test.cpp:49: error: expected `;' before 'wxMenu'
Test.cpp:55: error: 'wxMenuBar' was not declared in this scope
Test.cpp:55: error: 'menuBar' was not declared in this scope
Test.cpp:55: error: expected type-specifier before 'wxMenuBar'
Test.cpp:55: error: expected `;' before 'wxMenuBar'
Test.cpp:58: error: 'SetMenuBar' was not declared in this scope
Test.cpp:60: error: 'CreateStatusBar' was not declared in this scope
Test.cpp:61: error: 'SetStatusText' was not declared in this scope
Test.cpp: At global scope:
Test.cpp:64: error: variable or field 'OnQuit' declared void
Test.cpp:64: error: 'int MyFrame::OnQuit' is not a static member of 'class MyFrame'
Test.cpp:64: error: 'wxCommandEvent' was not declared in this scope
Test.cpp:64: error: 'event' was not declared in this scope
Test.cpp:64: error: 'WXUNUSED' was not declared in this scope
Test.cpp:65: error: expected ',' or ';' before '{' token
Test.cpp:69: error: variable or field 'OnAbout' declared void
Test.cpp:69: error: 'int MyFrame::OnAbout' is not a static member of 'class MyFrame'
Test.cpp:69: error: 'wxCommandEvent' was not declared in this scope
Test.cpp:69: error: 'event' was not declared in this scope
Test.cpp:69: error: 'WXUNUSED' was not declared in this scope
Test.cpp:70: error: expected ',' or ';' before '{' token