When using CLion, I found that the output is sometimes disabled.
For example, when running the code:
main.cpp
#include <stdio.h> int main() { int i; for (i = 0; i < 1000; i++) { printf("%d\n", i); } fflush(stdout); // Shouldn't be needed as each line ends with "\n" return 0; }
Expected Result
The expected result is obviously the numbers 0-999 on each new line.
Actual output
After executing the code several times in CLion, the output often changes:
- Sometimes it executes perfectly and shows all the numbers 0-999
- Sometimes it turns off at different points (for example, 0-840)
- Sometimes it doesn’t output anything
The return code is always 0!
Screenshot

Running code in a terminal (i.e. not in CLion itself)
However, when compiling and executing code using the terminal, the code perfectly displays the numbers 0-999.
I spent so much time thinking that it was a problem with my code and memory problem, until I finally realized that it was just a problem with CLion.
OS : Ubuntu 14.04 LTS
Version : 2016.1
Build : # CL-145.258
Update
A suitable solution is to run the code in debug mode (thanks to @olaf).
clion
Yahya Uddin
source share