0 Members and 1 Guest are viewing this topic.
david@DavidPC:~$ wx-config --version2.9.1david@DavidPC:~$
/* * hworld.cpp */#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( 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 wxWidgets!") );}void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)){ Close(TRUE);}void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)){ wxMessageBox( _("This is a wxWidgets Hello world sample"), _("About Hello World"), wxOK | wxICON_INFORMATION, this);}
g++ helloWorldGUI.cpphelloWorldGUI.cpp:5:20: error: wx/wx.h: Ficheiro ou directoria inexistentehelloWorldGUI.cpp:8: error: expected class-name before ‘{’ tokenhelloWorldGUI.cpp:13: error: expected class-name before ‘{’ tokenhelloWorldGUI.cpp:16: error: ISO C++ forbids declaration of ‘wxString’ with no typehelloWorldGUI.cpp:16: error: expected ‘,’ or ‘...’ before ‘&’ tokenhelloWorldGUI.cpp:18: error: ‘wxCommandEvent’ has not been declaredhelloWorldGUI.cpp:19: error: ‘wxCommandEvent’ has not been declaredhelloWorldGUI.cpp:21: error: ISO C++ forbids declaration of ‘DECLARE_EVENT_TABLE’ with no typehelloWorldGUI.cpp:22: error: expected ‘;’ before ‘}’ tokenhelloWorldGUI.cpp:22: error: expected ‘;’ before ‘}’ tokenhelloWorldGUI.cpp:30: error: ‘wxFrame’ has not been declaredhelloWorldGUI.cpp:31: error: expected constructor, destructor, or type conversion before ‘EVT_MENU’helloWorldGUI.cpp:46: error: ISO C++ forbids declaration of ‘wxString’ with no typehelloWorldGUI.cpp:46: error: expected ‘,’ or ‘...’ before ‘&’ tokenhelloWorldGUI.cpp: In constructor ‘MyFrame::MyFrame(int)’:helloWorldGUI.cpp:47: error: class ‘MyFrame’ does not have any field named ‘wxFrame’helloWorldGUI.cpp:47: error: ‘NULL’ was not declared in this scopehelloWorldGUI.cpp:47: error: ‘title’ was not declared in this scopehelloWorldGUI.cpp:47: error: ‘pos’ was not declared in this scopehelloWorldGUI.cpp:47: error: ‘size’ was not declared in this scopehelloWorldGUI.cpp:49: error: ‘wxMenu’ was not declared in this scopehelloWorldGUI.cpp:49: error: ‘menuFile’ was not declared in this scopehelloWorldGUI.cpp:49: error: expected type-specifier before ‘wxMenu’helloWorldGUI.cpp:49: error: expected ‘;’ before ‘wxMenu’helloWorldGUI.cpp:51: error: ‘_’ was not declared in this scopehelloWorldGUI.cpp:55: error: ‘wxMenuBar’ was not declared in this scopehelloWorldGUI.cpp:55: error: ‘menuBar’ was not declared in this scopehelloWorldGUI.cpp:55: error: expected type-specifier before ‘wxMenuBar’helloWorldGUI.cpp:55: error: expected ‘;’ before ‘wxMenuBar’helloWorldGUI.cpp:58: error: ‘SetMenuBar’ was not declared in this scopehelloWorldGUI.cpp:60: error: ‘CreateStatusBar’ was not declared in this scopehelloWorldGUI.cpp:61: error: ‘SetStatusText’ was not declared in this scopehelloWorldGUI.cpp: At global scope:helloWorldGUI.cpp:64: error: variable or field ‘OnQuit’ declared voidhelloWorldGUI.cpp:64: error: ‘wxCommandEvent’ was not declared in this scopehelloWorldGUI.cpp:64: error: ‘event’ was not declared in this scopehelloWorldGUI.cpp:64: error: ‘WXUNUSED’ was not declared in this scopehelloWorldGUI.cpp:69: error: variable or field ‘OnAbout’ declared voidhelloWorldGUI.cpp:69: error: ‘wxCommandEvent’ was not declared in this scopehelloWorldGUI.cpp:69: error: ‘event’ was not declared in this scopehelloWorldGUI.cpp:69: error: ‘WXUNUSED’ was not declared in this scopedavid@DavidPC:~/Documentos/C++$
g++ -c `wx-config --cxxflags` helloWorldGUI.cppg++ -o helloWorldGUI helloWorldGUI.o `wx-config --libs`
sudo apt-get install libwxgtk2.8-dev
I finally did it, and it's working well =D Thanks.
david@DavidPC:~/Documentos/C++$ g++ -c `wx-config --cxxflags` helloWorldGUI.cppdavid@DavidPC:~/Documentos/C++$ g++ -o helloWorldGUI helloWorldGUI.o `wx-config --libs`david@DavidPC:~/Documentos/C++$ ./helloWorldGUI