0

用vscode调试c++,需要输入,如图1,我看有另一个问题里说切换到"终端"输入,但是切换后界面如图2,显然是不行的,是哪里需要设置吗
launch.json 和 tasks.json如下

launch.json

{
"version": "0.2.0",
"configurations": [
    {
        "preLaunchTask": "build",
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/main.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceRoot}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "lldb"
    }
]

}

tasks.json

{

"version": "2.0.0",
"tasks": [
    {
        "taskName": "build",
        "command": "g++",
        "args": [
           "-g", "${file}", "-o", "main.exe"
        ],
        "group": "build",
        "presentation": {
            "reveal": "silent"
        },
        
        "problemMatcher": {
    "owner": "cpp",
    "fileLocation": ["relative", "${workspaceRoot}"],
    "pattern": {
        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
        "file": 1,
        "line": 2,
        "column": 3,
        "severity": 4,
        "message": 5
    }
}
    }
]

}

撰写答案