SDL causes console to disappear [solved]

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

SDL causes console to disappear [solved]

Post 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?
Last edited by torleif on Sun Jul 13, 2008 12:02 am, edited 1 time in total.
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post 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
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Post 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!
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
Post Reply