How can I get console output instead of stdout.txt and stderr.txt?
SDL_Init() routes stdout and stderr to the respective files. You can revert this by adding the following lines after the call to SDL_Init in your code:
freopen( "CON", "w", stdout ); freopen( "CON", "w", stderr );
* If that doesn't work try adding these 2 lines at the very beginning of your code (SDL_Init wrapper or in top of your main)
For those of you using Visual Studio .NET (probably works with VC6 too), in project properties be sure to set linker->subsystem to CONSOLE, or your project won't be allowed to trigger a console even if you've done everything correctly.
If that doesn't work, another option is to recompile libSDLmain.a. The easiest way to do so is by using MinGW and MSYS:
Download the SDL source code SDL-1.2.9.zip, and unpack it into C:\
- Open MSYS, and do the following:
$ cd /c/SDL-1.2.9 $ ./configure --disable-stdio-redirect $ cd src/main $ make
There should now be a new libSDLmain.a in C:\SDL-1.2.9\src\main. Copy that file to the appropriate location for your compiler/linker. If you're using MinGW that will probably be C:\MinGW\lib.
Recompile your program. Be sure that you don't pass -mwindows to the compiler, or things still won't work!
Another option is to include SDL-1.2.9\src\main\win32\SDL_win32_main.c from the SDL source in your project and then not link with libSDLmain.a at all. When you compile your program, be sure to pass -DNO_STDIO_REDIRECT to the compiler. Once again, also be sure that you don't pass -mwindows to the compiler.
