【问题标题】:Issues in Debugging C++ programns on VS Code在 VS Code 上调试 C++ 程序的问题
【发布时间】:2021-08-17 03:35:56
【问题描述】:

调试器似乎运行正常,但显然它没有在任何断点处停止。我曾尝试重新安装 VS Code 和 MinGW Complier,但似乎没有任何效果。我已包含“launch.json”和“tasks.json”文件以供参考。

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": true,
        "cwd": "C:\\MinGW\\bin",
        "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": "C/C++: g++.exe build active file"
    }
]

}

Tasks.json

{
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++.exe build active file",
        "command": "C:\\MinGW\\bin\\g++.exe",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe"
        ],
        "options": {
            "cwd": "C:\\MinGW\\bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Task generated by Debugger."
    }
],
"version": "2.0.0"

}

【问题讨论】:

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


    【解决方案1】:

    问题已解决。我参考了很多其他答案,但找不到任何对我有用的东西。 然而,在更新 C++ 扩展后,调试器工作正常。

    【讨论】:

      猜你喜欢
      • 2020-08-25
      • 2020-07-28
      • 2018-05-13
      • 2021-04-25
      • 2020-10-18
      • 2021-03-22
      • 2020-12-22
      • 2020-03-18
      • 1970-01-01
      相关资源
      最近更新 更多