I've created a c++ project on ubuntu in visual studio code. It launches the program using gdb mode, but does not show anything in Output. When I launch program from console, the output is present. I tried inserting "console" property, but vscode tells me, that it is forbidden (from similar issue with node https://github.com/Microsoft/vscode/issues/30842).
How can I enable vscode to show the output from my program?
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
To open the Output window, on the menu bar, choose View > Output, or press Ctrl+Alt+O.
From a command prompt or a new VS Code Integrated Terminal, you can now run your program by typing ".\helloworld". If everything is set up correctly, you should see the output "Hello World". This has been a very simple example to help you get started with C++ development in VS Code.
Try uninstalling and reinstalling VS Code. If code is still not found, consult the platform-specific setup topics for Windows and Linux. On macOS, you need to manually run the Shell Command: Install 'code' command in PATH command (available through the Command Palette Ctrl+Shift+P).
Looks like you haven't saved the file. Try saving the file and then run with Code Runner. Tip: You can enable Save before Run settings so that it gets saved every time before running the file. code runner says it will run code that is not saved yet.
You config is correct. The program output should be in the DEBUG CONSOLE.
Menu | Debug Console or Ctrl+Shift+Y.
The program was launched in external terminal and due to the configuration of my screen I didn't see it. Everything works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With