1、VsCode Debug 调试问题

image.png
此时最主要的是配置两个文件夹在.vscode文件夹下:tasks.json和launch.json.

image.png
1.1 tasks.json配置文件如下:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "E:/MinGW/bin/g++.exe", // 将该部分修改为个人路径
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "E:/MinGW/bin", // 将该部分修改为个人路径
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
]
}
1.2 launch.json配置文件如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "E:\\MinGW\\bin\\gdb.exe", // 修改该部分路径为个人路径
"preLaunchTask": "compile",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
},
]
}
1.3 如果此时仍存在一些问题
下载以下文件夹
通过网盘分享的文件:mingw64.zip
链接: https://pan.baidu.com/s/1syOBBkVDqRMWzcUqn0pz2Q 提取码: 9gig
--来自百度网盘超级会员v5的分享
解压缩后将以下文件直接复制至原MinGW安装路径,并选择覆盖!

image.png