C++ build and debug with g++ in Windows Vscode
在Windows Vscode
上配置C/C++
调试环境。
需要在项目文件夹新建.vscode/
,新建以下两个文件:
tasks.json
tasks.json
用于C/C++
build
1 | { |
launch.json
launch.json
用于C/C++
Debug
1 | { |
debugger console
兼容gdb
命令(需要加-exec
),命令格式:
1 | -exec <gdb command> |
例如:
1 | -exec p i |
GDB, LLDB, and LLDB-MI Commands (GDB/LLDB)
For the
C++ (GDB/LLDB)
debugging environment, you can execute GDB, LLDB and LLDB-MI commands directly through the debug console with the-exec
command, but be careful, executing commands directly in the debug console is untested and might crash VS Code in some cases.