在 VS CODE 中安装 C/C++ 插件

安装编译、调试环境
这里安装的是 MinGW, 官网如下:
http://mingw.org/

下载后,双击进行安装
安装路径可以根据需要来修改:

然后选择需要安装的模块,具体如下:
mingw32-gdb-bin、
mingw32-binutils-bin、
mingw32-gcc-bin、
mingw32-gcc-dev、
mingw32-gcc-doc、
mingw32-gcc-man、
mingw32-gcc-g++-bin、
mingw32-gcc-g++-dev、
mingw32-gcc-g++-doc、
mingw32-gcc-g++-man、
用途大概如下:
gdb : 用于调试;
gcc : 用于 C 语言编译;
g++ : 用于 C++ 编译;


选择完毕后,点击左上角的 Installation > Apply Changes 开始进行安装

注意:安装过程可能需要翻墙
为 MINGW 配置环境变量
在 Windows 10 中依次点击:
此电脑 > 高级系统设置 > 高级 > 环境变量


在 VS CODE 中配置调试内容
点击左边的调试图标(那个虫子图标),然后点击小齿轮,

选择 C++ (GDB/LLDB),

然后选择 g++.exe build and debug active file


打好的断点能顺利进行调试,效果如下图:
参考
整理:Visual Studio Code (vscode) 配置C、C++环境/编写运行C、C++(主要Windows、简要Linux)