SDL2 and CLion Console output
Answered
Hey,
I'm using CLion and SDL2. Everything works fine. But for some reason neither std::cout nor SDL_log (which is an SDL output function) seem to work. I cannot print anything to the console. No matter if it's debug or release. It does work though when I'm excluding SDL2 from cmake file.
I remember that in Visual Studio you had to choose a subsystem like "console". Is there any similar option in CLion?
Thanks for your help!
Please sign in to leave a comment.
Hello!
Do you use CLion on Windows? What toolchain do you use?
What happens if you create a default C++ executable in CLion and run it? Do you get the "Hello, World!" line in the Run tool window?
Hey
Yes, it's CLion on Windows. I'm using MinGW right now, 'cause it's the only toolchain which would work for SDL 2.0.8.
(I've tried Cygwin, but it wouldn't compile SDL2, which is an official issue)
Visual Studio is no option for CLion, 'cause it unfortunatley doesn't support debugging (yet)
Yes, as mentioned, if I exclude SDL2 from my project, std::cout does work again. std::cout did always work in any CLion project.
So this issue seems to be SDL2 related in combination with CLion.
(I haven't tried WSL yet)
Thank you for the details!
>Yes, as mentioned, if I exclude SDL2 from my project, std::cout does work again
Sorry, I've misread that in your post.
I've reproduced the problem with the Run action and created an issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-13868. Feel free to comment or upvote in order to get updates. However, Debug produces an output correctly on my side. Also there is a workaround - disabling PTY: go to Help | Find Action, type "Registry...", select it and in the opened list find and disable the run.processes.with.pty option (don't restart CLion after that). Please note the run.processes.with.pty option is not saved after CLion's restart and should be disabled again every time you open CLion (if you need it to be disabled). We have the issue in our tracker about that: https://youtrack.jetbrains.com/issue/CPP-8395.
Thank you :)