Page 1 of 1

SDL causes console to disappear [solved]

Posted: Sat Jul 12, 2008 5:56 am
by torleif
I have integrated the latest SDL into my project to use for sound. It works well, however when it comes to:

Code: Select all

#include <SDL/SDL.h> //here
#include <SDL/SDL_mixer.h>
It causes the output console to not print anything, and is separated from the irrlicht engine itself.

I'm guessing there is a precompilation marco I can set so it doesn't separate the console thread from the game

Any suggestions on where to begin?

Posted: Sun Jul 13, 2008 12:01 am
by torleif
Found the answer. By putting this before main:

Code: Select all

// This hack allows the SDL console to show in windows.
#ifdef main
#undef main
#endif
Other options include:

Code: Select all

#define NO_STDIO_REDIRECT 
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
// and:

// put this after SDL_Init
freopen(NULL,"w",stdout);
freopen(NULL,"w",stderr);
Now I can enjoy sound with no royalties >=D

Posted: Sun Jul 13, 2008 5:19 am
by d3jake
Thanks for the tip on this. When I added in SDL for the input code for joysticks I lost that and was forced to rely on the cerr.txt file for debug info when I added it in.

Thanks alot!