The output for the CLI IDE is sometimes disabled during program execution.

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

terminal output is disabled

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).

+7
clion
source share
1 answer

The consensus is that this is an IDE issue. Therefore, I reported an error.

A suitable solution is to execute code in debug mode (no breakpoint required).

I will update this question as soon as this error is fixed.

Update 1

A WARNING. You should not modify registry information unless you specifically ask a question using JetBrains. The registry is not in the main menu for some reason! Use the following solution at your own risk!

JetBrains contacted me and provided a suitable solution:

  • Go to the Action Search dialog box (CTRL + SHIFT + A)
  • Search "Registry ..."
  • Untick run.processes.with.pty

Should then work fine!

Update 2

A bug has been added here: https://youtrack.jetbrains.com/issue/CPP-6254

Feel free to upgrade it!

+7
source share

All Articles