Output can only shown on debug console on Visual Studio Code on macOS.
Environment
- OS and Version: macOS 14.1.2
- VS Code Version: 1.85.0
- C/C++ Extension Version: 1.18.5
- clang++ Version: 15.0.0
Bug Summary and Steps to Reproduce
Bug Summary: I can only get output from the debug console.
Steps to reproduce:
- Create an empty folder called
helloworldand open it with Visual Studio Code. - Create a cpp file called
main.cpp. - Add some basic code to the
main.cppfile like below
#include
int main() { std::cout << "Hello World!" << std::endl; return 0; }
- Press run button to the top right with clang++ 15.0.0.
- I can get from debug console.
Expected behavior:
I expect the output shown in the terminal like in windows11.
Configuration and Logs
task.json:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Other Extensions
No response
Additional context
No response
@WardenGnaw Is this a known issue?
I have a similar issue but on windows
Environment
- OS and Version: Windows 10
- VS Code Version: 1.85.1 (system version)
- C/C++ Extension Version: 1.18.5
Bug Summary and Steps to Reproduce
Bug Summary:
I just want ro run the code without the debugger.
1: I choose Run C/C++ File
2: I can only choose gcc.exe build and debug active file
3: The debugger starts and the output is only shown in the debugger window
I tried modifying the .json but the debugger always starts.
Expected behavior: See the output in the terminal without starting the debugger
Configuration and Logs
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\MinGW\\bin\\gcc.exe",
"args": [
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Other Extensions
No response
Additional context
No response
I have the same issue on macOS sonoma 14.3
Same issue - Sonoma 14.4.1
Same issue on macOS Sequioa 15.1 and Windows 11 24H2
Same issue on macOS 15.1.1 . I try to another way to solve this issue, Downloading code runner from the vscode expansion store can solve this problem at the expense of being unable to debug. In addition, you can download Code LLDB in the expansion store and configure it in .vscode/launch.json as follows: { "version": "0.2.0", "configurations": [ { "type": "lldb", "request": "launch", "name": "Cpp_Debug", "terminal": "integrated", "program": "${workspaceFolder}/${fileBasenameNoExtension}", "args": [], "cwd": "${workspaceFolder}" }, ] } Maybe it can solve some of the problems.
Same issue on windows
same
same, can't figure out why while it works fine in ubuntu machine
Go in your lunch.json file and change the property: externalConsole to true:
... "externalConsole": true, ...
This fixed it for me on mac.