C++ VS代码调试器不';t开放式终端

C++ VS代码调试器不';t开放式终端,c++,debugging,visual-studio-code,vscode-debugger,C++,Debugging,Visual Studio Code,Vscode Debugger,我正在尝试在vs代码上创建一个cpp环境。生成时可以运行.exe,但调试器似乎无法运行。当我点击rundebug选项时,另一个终端打开并显示一条消息(附在屏幕截图中)。我正在运行的代码是一个简单的hello world示例。调试器未打开具有Hello World的终端。Hello world应该显示在终端2的屏幕截图中,但另一条消息被打印出来,我对此一无所知 以下是配置文件的代码: task.json { "version": "2.0.0", "tasks": [

我正在尝试在vs代码上创建一个cpp环境。生成时可以运行.exe,但调试器似乎无法运行。当我点击rundebug选项时,另一个终端打开并显示一条消息(附在屏幕截图中)。我正在运行的代码是一个简单的hello world示例。调试器未打开具有Hello World的终端。Hello world应该显示在终端2的屏幕截图中,但另一条消息被打印出来,我对此一无所知

以下是配置文件的代码:

task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": [
                "sample.cpp"
            ],
            "problemMatcher": []
        }
    ]
}
{
    // 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": "g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "C:\\Users\\Amey\\Desktop\\work\\Programming\\C++\\a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"
        }
    ]
}
launch.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": [
                "sample.cpp"
            ],
            "problemMatcher": []
        }
    ]
}
{
    // 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": "g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "C:\\Users\\Amey\\Desktop\\work\\Programming\\C++\\a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"
        }
    ]
}

您正在查看“调试”选项卡吗?尝试更改为
“externalConsole”:true,
。是否正在查看调试选项卡?尝试更改为
“externalConsole”:true,