This example provides a guide for setting up a C/C++ development environment using Visual Studio Code, which can be executed on Windows, macOS, and Linux. For detailed instructions, please refer to this article.
First, use winget
to install Visual Studio Code
and Chocolatey
, then use Chocolatey
to install mingw
.
winget install --id=Microsoft.VisualStudioCode -e
winget install --id=Chocolatey.Chocolatey -e
choco install -y mingw
Use brew
to install Visual Studio Code
and install clang
& lldb
via xcode-select
.
brew install --cask visual-studio-code
xcode-select --install
Verify the installation of clang
and lldb
.
clang --version
lldb --version
Use apt
to install gcc
, g++
, and gdb
.
sudo apt update
sudo apt install -y build-essential
sudo apt install -y gdb
After cloning the repository, use Visual Studio Code
to open the folder. Open main.cpp
, press F5
, and you can start compiling and running the program.
git clone https://github.com/leoli0605/vscode.cpp