/vscode.cpp

Demonstrate how to develop C/C++ projects using VSCode.

Primary LanguageC++MIT LicenseMIT

Visual Studio Code C/C++ Development Environment Setup

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.

Environment Setup

Windows

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

macOS

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

Linux

Use apt to install gcc, g++, and gdb.

sudo apt update
sudo apt install -y build-essential
sudo apt install -y gdb

Compile, Run, and Debug

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