1、编辑launch.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations":[
{
// 配置名称,将会在启动配置的下拉菜单中显示
"name": "g++.exe build and debug active file",
// 配置类型,这里只能为cppdbg
"type": "cppdbg",
// 请求配置类型,可以为launch(启动)或attach(附加)
"request": "launch",
// 将要进行调试的程序的路径
"program": "C:\\Windows\\System32\\cmd.exe",
// 程序调试时传递给程序的命令行参数,一般情况设为空
"args": ["/C","${fileDirname}\\${fileBasenameNoExtension}.exe","&","pause"],
// 设为true时程序将暂停在程序入口处,一般设置为false
"stopAtEntry": false,