VS Code + GCC 配置要点
- 安装 VS Code
- 安装扩展:
C/C++(Microsoft)、Code Runner
- 安装编译器
- Windows:安装 MinGW-w64 或 WSL
- macOS:
xcode-select --install
- Linux:
sudo apt install gcc
- 验证:终端输入
gcc --version
{
"version": "2.0.0",
"tasks": [{
"label": "build",
"type": "shell",
"command": "gcc",
"args": ["-Wall", "-std=c11", "-g", "-o", "${fileDirname}/${fileBasenameNoExtension}", "${file}"]
}]
}