Author Topic: re: console runner message "process returned 3"  (Read 14413 times)

Offline bala_48225

  • Multiple posting newcomer
  • *
  • Posts: 17
re: console runner message "process returned 3"
« on: April 27, 2010, 06:00:31 pm »
Hello, I am:  Windows xp, codeblocks 8.02, MingW compiler.

The Console runner says "process returned 3" and the build log says "process terminated with status 3".  I had some problems prior with the program which is why I noticed that message, however now it runs fine now with my changes.  Nonetheless, I'm curious  as to what that number means and if it's significant, in case it's some kind of runtime error code.  Thx in advance for answers! -B  :)

Offline ptDev

  • Almost regular
  • **
  • Posts: 222
Re: re: console runner message "process returned 3"
« Reply #1 on: April 27, 2010, 06:17:21 pm »
The status number is nothing special from Code::Blocks. Either you had somewhere a 'return 3;' or equivalent in your main(), or an exception called exit(3). It's just the old error status return value that C++ inherited from C.

Offline bala_48225

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: re: console runner message "process returned 3"
« Reply #2 on: April 27, 2010, 09:07:03 pm »
thx!

Offline bala_48225

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: re: console runner message "process returned 3"
« Reply #3 on: October 11, 2010, 03:01:24 am »
I would now like to bring this (old) topic to a conclusion:  the reason the Console message window was saying "process returned 3" was for one and only one reason:  freeing a nonexistent SDL surface from an array of surfaces, e.g.
Code
 for(i=0;i<6;i++) SDL_FreeSurface(img[i]);
 So... if you get this sort of response (process returned 3), consider pressing F8 instead of F9 (to run the debugger along with your program); this will find the segfault and you'll see what your mistake was.  Alternatively, you could set the pointer to NULL at the beginning of the program and free the surface in your freeing loop at the end.  The impression I'm under is you can also not free it, since it points to nothing in the first place.    

Edit November 2, 2011:  The above isn't quite right, you should 1) initialize the surface to NULL at the start of the program.  2) freeing it at the end should be fine (as above), but to be pedantic:

Code
for(i=0; i<6; i++)
{
    if(img[i] != NULL)
    {
        SDL_FreeSurface(img[i]);
        img[i] = NULL;
    }
}

and at the beginning, always:
Code
SDL_Surface img[6];
for(Uint8 i = 0; i < 6; i ++)
    img[i] = NULL;
// then load

This topic has been read 1600 times, so I thought I would "point" people in the right direction.
« Last Edit: November 03, 2011, 02:56:19 am by bala_48225 »