Originally Posted by
shiroaisu
I tried to use SDL_Init() to initialize SDL components one at a time, and then I used breakpoints to try to figure out if there was a particular component that might've been causing this. The behavior is weird: it seems like I can only initialize the video and audio components, and any other components will cause this "exception" to stop program flow. This is really weird as I don't feel like I've encountered this problem before, and I've been working with SDL for quite a few years now.
I have the latest SDL version, and I've also tried this out on multiple versions of MinGW and no luck.
You don't show us your code.
I use SDL2 (2.0.5) on Linux and have no problem with the following function.
Code:
// This function returns 1 if any problem occur, otherwise it returns 0
int init_sdl(void) {
// Initialize SDL video
if(SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "SDL could not initialize video! SDL_Error: %s\n", SDL_GetError());
return 1;
}
// Initialize SDL audio
if(SDL_Init(SDL_INIT_AUDIO) < 0) {
fprintf(stderr, "SDL could not initialize audio! SDL_Error: %s\n", SDL_GetError());
return 1;
}
// Initialize SDL joystick
if (SDL_Init(SDL_INIT_JOYSTICK) < 0) {
fprintf(stderr, "SDL could not initialize joysticks! SDL_Error: %s\n", SDL_GetError());
return 1;
}
return 0;
}
Work this funtion for you?