How to build standalone wxWidgets application

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to build standalone wxWidgets application

Post by doublemax »

For completeness sake:
Is it possible, that my global pointer to Frame can cause the crash?
No. A pointer in itself is safe, the question is when the instance of the class gets created. If you do it in OnInit(), it's fine.
Use the source, Luke!
ValeV

Re: How to build standalone wxWidgets application

Post by ValeV »

Thank you. Can you give any information on my "fix"?
EDIT: I MANAGED TO "FIX" IT. I don't know if it's fixed, but it stopped crashing. In CodeBlocks went to build options and unchecked "Optimize even more" (4th flag under Optimization).
Apparently there ware a few optimization bugs in wxWidgets headers, but they were fixed some time ago?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to build standalone wxWidgets application

Post by doublemax »

Can you give any information on my "fix"?
Not really. But if compiler optimization was the root of the problem, it would have been a bug in the compiler, not wxWidgets.
Use the source, Luke!
ValeV

Re: How to build standalone wxWidgets application

Post by ValeV »

I think I may have found a possible bug in my app. Let me know what you think. :)

I realized I don't have

Code: Select all

void OnClose(wxCloseEvent& event);
function, and its implementation.

I don't remember deleting it, but maybe I did it because with it, the X button (Close application) in upper right corner of application didn't work. Without it, X works fine.

Is this possible?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to build standalone wxWidgets application

Post by doublemax »

The default behavior of a wxFrame is to destroy itself when it's closed. But if you override that by catching the close event, you're responsible for what happens. Usually you just have to call event.Skip() inside the close event handler, so that the default behavior is still executed. In that case you must not delete the frame yourself.
Use the source, Luke!
Post Reply