VScode C++环境调试代码出错

VScode C++环境调试代码出错:

出错报警:
Unable to start debugging.Launch options string provided by the project system is invalid.
如下图:

调试时出现的错误类型

launch.json 与task.json 代码如下:

lauch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Launch (GDB)",
            "preLaunchTask": "build",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            //"miDebuggerPath": ".\\.portable\\MinGW\\bin\\gdb.exe",
            "miDebuggerPath": "C:\\MinGW\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }]
}

task.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared"
            },
            "windows": {
                "command": "g++",
                "args": [
                    "-ggdb",
                    "\"${file}\"",
                    "--std=c++11",
                    "-o",
                    "\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
                ]
            }
        }
    ]
}

vscode可以正常编译,但无法调试。求大佬们帮帮忙。

发布了18 篇原创文章 · 获赞 17 · 访问量 2706

猜你喜欢

转载自blog.csdn.net/chasinghope/article/details/83536708