- 将g++添加到环境遍历
- 安装插件”code runner”
- 设置-插件-run code configuration-Run in terminal 勾选上(否则如果程序里有输入等待将无法继续)
- 下载微软官方插件C/C++ 以便于调试
- 在目录下的.vs文件夹里面生成:launch.json/tasks.json
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "{fileDirname}/{fileBasenameNoExtension}.exe",
//"program": "enter program name, for example {workspaceFolder}/a.exe", "args": [], "stopAtEntry": false, "cwd": "{workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
//"miDebuggerPath": "/path/to/gdb",
"miDebuggerPath": "C:/Program Files (x86)/Dev-Cpp/MinGW64/bin/gdb.exe",
"preLaunchTask": "g++",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
…
Read the rest