Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the standard output of QtCreator when debugging?

I just realized the following when debugging a CMake (non-qt) project with QtCreator (not using it because of Qt but because it's a nice IDE) and CDB.

The program has a simple cout code line which is properly displayed in the "Application Output" pane when I run the program with Ctrl+R. However, if I debug the same build&run configuration with F5, I cannot see any output. Where does QtCreator forward stdout to in the second case?

like image 206
Tim Meyer Avatar asked Sep 13 '25 01:09

Tim Meyer


1 Answers

You can see the output printed on the debugging logs, which is a pane under Window->Views->Debugger Log

The right pane shows the expected output. Not a full solution but a very close workaround.

I believe qt creator sees only the output from cdb and it doesn't forward the program's output, but only its own. In fact, the application output pane displays one line of cdb's output related to a system call I make within my program.

This workaround causes a weird side-effect. When cdb hits a breakpoint, the colorscheme of that pane gets reset to default.

On a sidenote, there was a closed bug report stating

There is a difference to the old debugging engine in that the printf()-output of console-applications is suppressed in debug/console-builds of Qt Creator builds. In previous versions, the output used to go to the terminal Qt Creator was started in.

Not true in my case, as launching qtcreator from cmd detaches from cmd.

like image 173
quimnuss Avatar answered Sep 17 '25 21:09

quimnuss