vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Output can only shown on debug console on Visual Studio Code on macOS.

Open DevinJohw opened this issue 2 years ago • 9 comments

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:

  1. Create an empty folder called helloworld and open it with Visual Studio Code.
  2. Create a cpp file called main.cpp.
  3. Add some basic code to the main.cpp file like below

#include

int main() { std::cout << "Hello World!" << std::endl; return 0; }

  1. Press run button to the top right with clang++ 15.0.0.
  2. I can get from debug console.
image

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

DevinJohw avatar Dec 10 '23 08:12 DevinJohw

@WardenGnaw Is this a known issue?

sean-mcmanus avatar Dec 13 '23 00:12 sean-mcmanus

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 Screenshot (435)

2: I can only choose gcc.exe build and debug active file Screenshot (436)

3: The debugger starts and the output is only shown in the debugger window Screenshot (438)

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

tu7-pixel avatar Dec 31 '23 12:12 tu7-pixel

I have the same issue on macOS sonoma 14.3

lipingxu avatar Jan 31 '24 07:01 lipingxu

Same issue - Sonoma 14.4.1

tianwang95 avatar May 10 '24 17:05 tianwang95

Same issue on macOS Sequioa 15.1 and Windows 11 24H2

AWH1122 avatar Nov 14 '24 22:11 AWH1122

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.

895556898 avatar Nov 29 '24 14:11 895556898

Same issue on windows

Cluckin-sudo avatar Dec 31 '24 14:12 Cluckin-sudo

same

AndreeaDieaconu avatar Mar 03 '25 16:03 AndreeaDieaconu

same, can't figure out why while it works fine in ubuntu machine

foruniverse avatar May 23 '25 11:05 foruniverse

Go in your lunch.json file and change the property: externalConsole to true:

... "externalConsole": true, ...

This fixed it for me on mac.

ved-leahcim avatar Aug 22 '25 08:08 ved-leahcim