How on earth does anyone manage to compile wxwindows programs?
While compiling an example from the wxwindows tutorial, I get
g++ -I/usr/lib/wx/include/base-2.4/ wxhello.cc -o wxhello
In file included from /usr/include/wx/window.h:27,
from /usr/include/wx/toplevel.h:25,
from /usr/include/wx/frame.h:23,
from wxhello.cc:18:
/usr/include/wx/cursor.h: In constructor `
wxBusyCursorSuspender::wxBusyCursorSuspender()':
/usr/include/wx/cursor.h:46: error: `wxIsBusy' undeclared (first use this
function)
/usr/include/wx/cursor.h:46: error: (Each undeclared identifier is reported
only once for each function it appears in.)
/usr/include/wx/cursor.h:48: error: `wxBusyCursor' undeclared (first use this
function)
/usr/include/wx/cursor.h:48: error: parse error before `;' token
and pages and pages more error messages, ending with
usr/include/wx/window.h:837: confused by earlier errors, bailing out
Now wxIsBusy is defined in /usr/include/wx/utils.h,
but this file is already included by wx.h. However, it's conditional on
an
#if wxUSE_GUI // GUI only things from now on
However, adding a compiler flag _DwxUSE_GUI=1 doesn't seem to help any.
**What have I failed to do?**
And where is it documented?
It never even gets around to my own code, which, by the way, is here:
=====
//
// file name: hworld.cpp
//
// purpose: wxWidgets "Hello world"
//
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/frame.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);
private:
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 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 );
}
=====
Reply to: