SDL2 Redirects stdout to null on Mingw

I’m trying to write out to the console when my program runs.

I have seen some solutions suggest recompiling the source with SDL_NO_REDIRECT defined, but I don’t want to have to do that unless it’s a last resort. (mainly because I don’t want to introduce more possibility of errors).

I’m using CMake and VSCode.

I saw a suggestion to try set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE FALSE) but that didn’t appear to work.

Why have they done this? And only for the Mingw version? The VS version doesn’t seem to do it.

Anyone got an easy solution?

Hi all - I gave in and tried recompiling SDL2. It wasn’t that difficult in the end. I commented out the line: list(APPEND EXTRA_LDFLAGS "-mwindows") from the CMakeLists.txt in the source folder and adjusted mine to include it, now it all works as expected :slight_smile: