App does not run with Events

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
muli_treiber
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Apr 10, 2008 7:46 pm

App does not run with Events

Post by muli_treiber » Thu Apr 10, 2008 8:08 pm

Hi,
2 things at the begining,
1st: if this istn the right Forum please move this Thread.
2nd: im a beginer with wxwidgets

My App does not initialise when i define Events. I get an Error "Your Application could not be initialised properly 0xc0000005"
Here the Code of my simple App

Code: Select all

#include <wx/wx.h>

class Face : public wxApp {
    public:
        virtual bool OnInit();
};

class BasicFace : public wxFrame {
    private:
        wxPanel *panel;
        wxButton *button;

    DECLARE_EVENT_TABLE()

    public:
        BasicFace(const wxChar *title, int xpos, int ypos, int width, int height);
        ~BasicFace();
        void OnClickButtonOk(wxCommandEvent &event);
};

IMPLEMENT_APP(Face)

bool Face::OnInit(){
    BasicFace *frame = new BasicFace( wxT("Face"),570,300,300,300);
    frame->Show(true);
    SetTopWindow(frame);
    return true;}

BasicFace::BasicFace(const wxChar *title, int xpos,int ypos,int width,int height) : wxFrame( (wxFrame *) NULL,-1,title,wxPoint(xpos,ypos),wxSize(width,height),wxDEFAULT_FRAME_STYLE){
    panel = new wxPanel(this, wxID_ANY,wxDefaultPosition,wxSize(200,100));
    button = new wxButton(panel,wxID_OK,wxT("Exit"),wxPoint(10,10),wxDefaultSize);}

BasicFace::~BasicFace(){}

BEGIN_EVENT_TABLE(BasicFace, wxFrame)
   EVT_BUTTON(wxID_OK,BasicFace::OnClickButtonOk)
END_EVENT_TABLE()

void BasicFace::OnClickButtonOk(wxCommandEvent &event){
    Close();}
When i delete

Code: Select all

DECLARE_EVENT_TABLE()
and

Code: Select all

BEGIN_EVENT_TABLE(BasicFace, wxFrame)
   EVT_BUTTON(wxID_OK,BasicFace::OnClickButtonOk)
END_EVENT_TABLE()
the App is running fine.
In both cases the App is compiling without problems.
I compiled wxWidgets with mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1. As you can imagine im using mingw, winxp sp1.
I really cant figure out what is going wrong here.
I hope u can help me.

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Thu Apr 10, 2008 8:45 pm

Hi,

There must be something not configured correctly for the compiler or the linker.

The code runs fine for me (I can click the exit button).

I'm not using unicode though and I'm using SP2.

Jim
OS: Vista SP1, wxWidgets 2.8.7.

muli_treiber
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Apr 10, 2008 7:46 pm

Post by muli_treiber » Thu Apr 10, 2008 9:54 pm

k rolled everything back and build my sys this way.

downloaded/install latest mingw
installed wxWidgets (2.8.7)
compiled wxWidgets with "mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=0"
placed the newly created "libwxmsw28.a" and "wxmsw28_gcc_custom.dll" into the folder with my App source file
copied wxWidgets include files into the MinGW directory
copied the newly created inlude files "setup.h,...." into the MinGW include directory
building my app g++ -o app.exe app.cpp libwxmsw28.a
=> results in error with Events

Did i forgot something important ?

muli_treiber
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Apr 10, 2008 7:46 pm

Post by muli_treiber » Mon Apr 14, 2008 7:32 pm

so i kicked sp1 and installed sp2.
and now, i get that error even without events.

how to compile a simple prog with wxwidgets ? i couldnt find anywhere an example.
so far im doin this way:

g++ -o app.exe app.cpp libwxmsw28.a

can someone confirm this ?

this is very frustrating for me not being able to start such a simple app.

protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Post by protocol » Tue Apr 15, 2008 2:09 am

Try adding:

Code: Select all

DECLARE_APP(Face)
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!

muli_treiber
In need of some credit
In need of some credit
Posts: 4
Joined: Thu Apr 10, 2008 7:46 pm

Post by muli_treiber » Tue Apr 15, 2008 8:26 pm

K tested it

Code: Select all

DECLARE_APP(Face)
doesnt work either.

But the situation gets weirder. I was really confused y my App suddenly didnt start even without Events.
So i used my wxmsw28_gcc_custom.dll which was built before i installed sp2. And whoouu the App starts without Events again ( but still not with them).
And in fact my both wxmsw28_gcc_custom.dll ´s are diffrent in size (about 3kb difference). The wxWidgets Version and build options were the same, i got to check if it was the same mingw version.
Perhaps (hopefuly) my mingw is doing shit.

If someone got an idea pls write it :P.

@edit:
i downloaded everything again from the mingw page and compiled wxwidgets but i only get a non functional dll.
i cant recreate the dll which works at least without Events.
just frustrating...

Post Reply