更新:其实微软是有官方文档配置VS code 的C++的。地址是:
https://code.visualstudio.com/docs/cpp
更改工作区后就发现不能再使用VS CODE愉快地写C++得到实时反馈了,排查一下,发现是launch.json没有配置好gdb路径。
"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": "F:/mingw64/bin/gdb.exe", "preLaunchTask": "g++", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], }, ] }
更改成这个就可以了,
"miDebuggerPath":后面跟自己的mingw64/bin/gdb.exe 路径