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.
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:
for(i=0; i<6; i++)
{
if(img[i] != NULL)
{
SDL_FreeSurface(img[i]);
img[i] = NULL;
}
}
and at the beginning, always:
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.