1. VS Code Installation Steps
Download from the official website: https://code.visualstudio.com/, choosing the version for your operating system:
- Windows: choose the
Windowsversion —.exeinstaller - macOS: choose the
macOSversion —.dmgimage - Linux: choose
.deb(Debian/Ubuntu) or.rpm(CentOS/RHEL) for your distribution, or the.tar.gzarchive
Double-click the downloaded .exe file to start the wizard:
- Check
I accept the agreementand clickNext - Choose the install location (the default is recommended, or use a path without non-ASCII characters)
- Key step: in
Select Additional Tasks, make sure to check:- ✅ Add to PATH (so you can call the
codecommand in the terminal) - ✅ Create a desktop icon
- ✅ Register code as an editor for supported file types (optional, recommended for .cpp/.c)
- ✅ Add to PATH (so you can call the
- Click
Install, wait for it to finish, then clickFinish
Double-click the downloaded .dmg file and drag the VS Code icon into Applications; open Launchpad, find VS Code and launch it (first launch may ask for authorization — follow the prompts).
Open VS Code:
- Choose a theme: click
Color Themeand pickDark+ (default dark)(easier on the eyes, better code contrast) - Skip the recommended extensions for now; configure the C/C++ extensions later
2. Essential C/C++ Extensions
Open VS Code, click the Extensions icon in the activity bar (or press Ctrl+Shift+X), type the extension name in the search box, find it and click Install.
Recommended extensions
| Extension | Publisher | Core feature |
|---|---|---|
| C/C++ | Microsoft | Official core extension: syntax highlighting, IntelliSense, formatting and debugging for C/C++ |
| C/C++ Extension Pack | Microsoft | Extension pack including C/C++, CMake Tools, etc. — installs all basics in one click |
| Code Runner | Jun Han | One-click code running for C/C++ and many other languages |
| Doxygen Documentation Generator | Marat Dulin | Generates Doxygen documentation for comments and API docs |
| vscode-icons | vscode-icons-team | Rich icons to make the file tree clearer |
| Serial Monitor | Mads Kristensen | Serial port tool for embedded/MCU debugging |
| CMake Tools | Microsoft | Auto-detects CMakeLists.txt with integrated build/debug support |
Optional enhancements
- GitLens: enhances Git integration — commit history, authorship, multi-developer collaboration
- Better Comments: color-coded comments by type (warnings, TODO, notes)
3. SSH Remote Connection (Remote C Development)
Search for Remote - SSH (by Microsoft) in the Extensions view and click Install. Afterwards a Remote Explorer icon (shaped like a monitor) appears in the activity bar.
Click the Remote Explorer icon, click the Configure gear icon under SSH Targets, and choose the SSH config file path:
- Windows:
C:\Users\your-username\.ssh\config - macOS/Linux:
~/.ssh/config(created automatically if missing)
Add the remote server information to the config file (adjust to your environment) and save (Ctrl+S):
# Custom host name (easy to remember, e.g., linux-server)
Host linux-server
# Remote server IP address or domain
HostName 192.168.1.100
# Login user name (must be an actual user on the server, not necessarily ubuntu)
User ubuntu
# SSH port (default 22; use the actual port if changed)
Port 22In the Remote Explorer, find the host name you just configured under SSH Targets, right-click it and choose:
Connect to Host in Current Window: connect in the current window (closes the local project)Connect to Host in New Window: connect in a new window (keeps the local project, recommended)
The first connection asks you to select the platform (choose e.g. Linux); then enter the remote login password (nothing is shown while typing — press Enter when done); if asked Are you sure you want to continue connecting, type yes and press Enter. Once connected, SSH: host-name shows in the bottom-left corner.
Configure the C environment on the remote server
Once connected, VS Code shows the remote indicator (SSH: host-name in the bottom-left). Install the C compiler on the remote server:
You can install the same extensions on the remote server so you can switch between local and remote
Open the VS Code integrated terminal (Ctrl+`) and run (gcc is the C compiler, g++ the C++ compiler, gdb the debugger):
sudo apt update && sudo apt install -y gcc g++ gdbRun:
sudo yum install -y gcc gcc-c++ gdbRun gcc --version; a version line (e.g., gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0) means the installation succeeded.
gcc --version4. Connect to WSL
Install WSL first — see the WSL installation tutorial
Then install the Ubuntu distribution — see the Ubuntu installation tutorial — WSL section
Search for WSL (by Microsoft) in the Extensions view and click Install. Afterwards a Remote Explorer icon appears in the activity bar.

In the Remote Explorer, find your distribution under WSL Targets (e.g., Ubuntu-20.04), right-click it and choose Connect to WSL (in the current or a new window).
On the first connection VS Code downloads the VS Code Server into WSL — please wait patiently.
FAQ
“gcc is not recognized as an internal or external command” (local Windows)
MinGW is not installed or not on PATH: download MinGW, check mingw32-gcc-g++ during installation, add MinGW's bin directory (e.g., C:\MinGW\bin) to the system Path variable, and restart VS Code.
SSH connection says “Permission denied”
Verify the user name and password (mind the case). If the server disallows password login, set up key-based auth: run ssh-keygen -t rsa locally (press Enter through the prompts), upload the public key with ssh-copy-id user@server-ip, and add an IdentityFile entry pointing to your local private key in the SSH config.
“Debugger not found” when debugging
The gdb debugger is missing: on local Windows, check mingw32-gdb in the MinGW installer; on the remote server, run sudo apt install gdb (or sudo yum install gdb).
Have questions?
For any other questions, visit the unified Q&A and discussion board: Ai-Thinker Discussions

