Links:
Name: C/C++ Id: ms-vscode.cpptools Description: C/C++ IntelliSense, debugging, and code browsing. Version: 1.7.1 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
Name: C/C++ Extension Pack Id: ms-vscode.cpptools-extension-pack Description: Popular extensions for C++ development in Visual Studio Code. Version: 1.1.0 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack
Name: C/C++ Themes Id: ms-vscode.cpptools-themes Description: UI Themes for C/C++ extension. Version: 1.0.0 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-themes
Name: C/C++ Compile Run Id: danielpinto8zz6.c-cpp-compile-run Description: Compile & Run single c/c++ files easly Version: 1.0.15 Publisher: danielpinto8zz6 VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=danielpinto8zz6.c-cpp-compile-run
Name: Better C++ Syntax Id: jeff-hykin.better-cpp-syntax Description: The bleeding edge of the C++ syntax Version: 1.15.10 Publisher: Jeff Hykin VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=jeff-hykin.better-cpp-syntax
- 下载 MSYS2
- 从开始菜单运行 MYSYS2 MYSYS 并按前后顺序运行以下命令:
pacman -Syu
update the core dependencies and all the packages currently installed on MSYS2pacman -Su
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-gdb
- 添加 GCC 到系统环境变量:Windows 设置搜索 “环境” 点开
编辑系统环境变量
在下方系统环境变量里点Path
然后编辑
,添加 GCC 安装目录C:\msys64\mingw64\bin
。 - 检查:重新打开 Terminal 输入
gcc --version
和gdb --version
检查配置是否成功,如果显示类似如下内容,那说明配置成功,可以愉快的编写并 debug C++ 代码了😄
gcc.exe (Rev5, Built by MSYS2 project) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU gdb (GDB) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
g++ (GCC): GNU c++ compiler invocation command
GDB: Debugger Tool