[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wxwindows setup.h



On Fri, Mar 11, 2005 at 07:55:47PM +0100, elton wrote:
> On Fri, Mar 11, 2005 at 10:38:07AM -0500, Hendrik Boom wrote:
> > In file included from /usr/include/wx/wxprec.h:13,
> >                  from wxhello.cc:8:
> > /usr/include/wx/defs.h:224:22: wx/setup.h: No such file or directory
> 
> 
> 
> You probably need wx libraries too.
> 
> It's either libwxbase2.2-dev or libwxgtk2.2-dev. (Or both)

Well, found that.  (I went back to the 2.4 release, by the way).

Immediately was informed that
    wxhello.cc:26: error: base class `wxFrame' has incomplete type
So I #included <wx/frame.h>

The was informed that 
    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.)

I did not find wxIsBusy by grepping the the obvious places.

Am I still doing something wrong?

The compile comand, from Makefile
	g++ -I/usr/lib/wx/include/base-2.4/ wxhello.cc -o wxhello

And my source code, actually cut & pasted from a tutorial.

//
// file name: wxhello.cc
//
//   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 );
}

> 
> In a case like this when you're missing files packages.debian.org is
> very helpful; just enter the file you are looking for and the packages
> providing them are shown.

I sould have thought of that.  Thanks.

-- hendrik



Reply to: