參考json
https://code.visualstudio.com/docs/cpp/config-mingwui
https://zhuanlan.zhihu.com/p/77645306 主要spa
官網給出的配置過程稍微複雜一些.net
如下內容參考 知乎 唐銘 https://zhuanlan.zhihu.com/p/77645306 插件
1.安裝vscode3d
官網下載安裝便可調試
2.安裝mingw64code
建議安裝離線版regexp
https://sourceforge.net/projects/mingw-w64/blog
安裝好後添加環境變量
檢測
3.安裝插件
安裝必要的插件,打開vscode,點擊左面豎排第五個按鈕,搜索並安裝
4.配置文件
新建文件夾(工做區)project
新建文件夾.vscode
新建文件launch.json,tasks.json
##launch.json
注意修改mingw路徑
{ "version": "0.2.0", "configurations": [ { "name": "C/C++", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "D:/mingw64/mingw64/bin/gdb.exe", "preLaunchTask": "g++", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], }, ] }
##tasks.json
{ "version": "2.0.0", "command": "g++", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "problemMatcher": { "owner": "cpp", "fileLocation": [ "relative", "${workspaceRoot}" ], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } }, "group": { "kind": "build", "isDefault": true } }
5.具體調試