microsoft / microsoft/vscode-cpptools

User input when debugging C++ on MacOs

Offen
#5,595 3 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@WardenGnaw arbeitet bereits daran.

Seit 03.6.2020.

debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Type: Debugger

Describe the bug

  • OS and Version:
    image

  • VS Code Version:
    image

  • C/C++ Extension Version: 0.28.1

  • Other extensions you installed (and if the issue persists after disabling them):
    image

  • A clear and concise description of what the bug is.
    When attempting to debug a simple C++ script that requires user input, the external console does not allow for the input to be given, instead displaying darwin-debug description (print screen in additional context.).

To Reproduce
Please include a code sample and launch.json configuration.

Code sample

#include <iostream>

using namespace std;

int main(){
    string output;

    cout << "Teste" << endl;
    cin >> output;

    cout << output << endl;

    return 0;
}

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "clang++ - Criar e depurar o arquivo ativo",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb",
            "preLaunchTask": "clang++ build active file"
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-std=c++17",
                "-stdlib=libc++",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Steps to reproduce the behavior:

  1. Create .vscode folder and within it setup tasks.json and launch.json.
  2. Create hello_world.cpp and paste the code sample.
  3. Select the run and debug tab.
  4. Click the green run icon.

Additional context
External console print screen
image

I have already tried using the workaround described at #https://github.com/microsoft/vscode-cpptools/issues/5079#issuecomment-626090192

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.