VS代码调试器无法打开终端

时间:2019-05-10 18:51:06

标签: c++ debugging visual-studio-code vscode-debugger

我正在尝试在vs代码上创建一个cpp环境。该生成有效,生成了.exe,但调试器似乎无效。当我单击运行调试选项时,另一个终端打开,并显示一条消息(如屏幕快照所示)。我正在运行的代码是一个简单的hello world示例。调试器不会打开带有Hello World的终端。 “ Hello world”应该显示在 终端2 的屏幕截图中,但打印了另一条消息,我对此一无所知。

Terminal 1

Terminal 2

这是配置文件的代码:

task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": [
                "sample.cpp"
            ],
            "problemMatcher": []
        }
    ]
}

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": "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"
        }
    ]
}

0 个答案:

没有答案