Reputation: 442
I have VS Code setup for running C/C++ code using the code runner extension, and everything runs pretty smoothly except for debugging. When I debug the program, the code gets compiled with the built-in build task and not code-runner, and the resulting output is shown in a separate console window, which is frustrating to work with when debugging, due to the active window focus issues. I want the output to show up in the integrated terminal in VS Code, just like it does during normal compilation using code-runner. Other answers on Stack Overflow suggest to include this in the launch.json file:
"console": "integratedTerminal"
,
but this piece of code seems to be outdated and unsupported in the current version of VS Code. Instead, looking at the IntelliSense suggestion, I tried including this in the launch.json file:
"externalConsole": false"
.
This does stop the external console from opening, although the integrated console does not show any output either, and now I'm left clueless as to where to view the output.
So how do I get the output while debugging to show up on the integrated console?
Upvotes: 5
Views: 2647
Reputation: 52334
If you're on Windows using the cppvsdebg
launch configuration type, then you need to be on a version of the C/C++ extension equal or greater than 1.2.0 and put "console": "integratedTerminal"
in your launch config. See Add new "console" launch config for cppvsdbg #6794.
If you're on macOS, the integrated terminal is currently not supported (see Run C/C++ code in terminal instead of debug console in VS Code on macOS?).
Otherwise, if you're using the cppdbg
launch configuration type, then you should be able to get the output in the integrated terminal by putting "externalConsole": false
in your launch config. See also https://code.visualstudio.com/docs/cpp/launch-json-reference#_externalconsole.
Upvotes: 0
Reputation: 440
If you are using type: "cppvsdbg"
on launch.json, unfortunately, the integrated terminal is not supported yet. So, you wont be able to get the output on the integrated console while debugging.
Upvotes: 1