Author Topic: Sample wxWidgets application under windows: terminated with status -1  (Read 5584 times)

whyisosad

  • Guest
I created a wxWidgets project with default settings. Everything is ok when I compiled and started the program, but after closing the appliication window, I got message from CodeBlocks:
Quote
Process terminated with status -1 (0 minutes, 1 seconds)
What's problem with it? I'm using wxWidgets-2.8.9, MinGW-5.1.4 and the newest nightly build on XP(with SP2) system.
PS:On my Debian system, it doesn't has this problem.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Sample wxWidgets application under windows: terminated with status -1
« Reply #1 on: December 20, 2008, 08:04:57 am »
It's normal in windows. There's no problem. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Sample wxWidgets application under windows: terminated with status -1
« Reply #2 on: December 20, 2008, 09:26:08 am »
It's normal in windows. There's no problem. :D

That's not right !!!

You created a dialog-based program I guessed, there the OnInit-function returns false if it ends, that leads to a program return-value of -1 on windows and 255 on linux  (at least on 64-bit linux).
In the frame-based sample it returns true, what leads to a program return-value of 0.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Sample wxWidgets application under windows: terminated with status -1
« Reply #3 on: December 21, 2008, 02:24:51 pm »
Thanks for your reply.
Yes, I just meant that "It's normal that the main() function should return a value".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.