使用Windows 10和MINGW编译器在VS Code上使用gdb调试器调试时出错

问题描述 投票:0回答:1

我正在遵循https://code.visualstudio.com/docs/cpp/config-mingw上的文档以在VS代码上设置我的C ++开发环境。

我成功创建了构建任务并运行了构建任务,但是当我尝试设置调试器(GDB调试器)时,在终端上得到了以下输出。

C:\Users\Ayon\c++\helloworld> cmd /C "c:\Users\Ayon\.vscode\extensions\ms-vscode.cpptools-0.28.1\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-shlwrnf5.x12 --stdout=Microsoft-MIEngine-Out-vg12hskh.c52 --stderr=Microsoft-MIEngine-Error-nrcvh0zz.0u0 --pid=Microsoft-MIEngine-Pid-m1nmxyvs.qk2 --dbgExe=C:\MinGW\bin\gdb.exe --interpreter=mi "
'cmd' is not recognized as an internal or external command,
operable program or batch file.

我对输出中的“ cmd /”如何产生感到好奇。请帮助我解决此错误。

提前感谢。

供参考,这是我的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": "${fileDirname}\\${fileBasenameNoExtension}.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": "g++.exe build active file"
        }
    ]
}
c++ visual-studio-code gdb mingw
1个回答
0
投票

您是否将mingw64 / bin添加到系统路径?方法如下:

Control panel -> Edit path -> Environment variables -> Path -> New

您也可以在vscode官方网站。

© www.soinside.com 2019 - 2024. All rights reserved.