-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
注意事项:vscode需要先编译,然后debug
环境配置
- 安装gcc g++ gdb
- 界面安装MSYS2
- 安装gcc g++ gdb
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain - 安装vscode,以及安装插件

- 配置工程
task.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"hi.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
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": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch", # 注意需要launch而不是attatch
"cwd": "${workspaceFolder}",//运行目录
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels