Visual Studio brings the full power of its IDE — IntelliSense, the debugger, and the project system — to Linux C++ development. You write and debug code on Windows while compiling and running it on a remote Linux machine, a Linux VM, or the Windows Subsystem for Linux (WSL). Linux header files are automatically synchronized to your Windows machine so IntelliSense works without leaving the IDE.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MicrosoftDocs/cpp-docs/llms.txt
Use this file to discover all available pages before exploring further.
Installing the Linux Development Workload
Open Visual Studio Installer
Type Visual Studio Installer in the Windows search box and open it. Click Modify next to your Visual Studio installation.
Select the workload
On the Workloads tab, scroll to Other toolsets and select Linux and embedded development with C++. This workload includes:
- Visual C++ for Linux development
- CMake support for Linux
- Embedded and IoT tooling (optional components)
CMake support for Linux is selected by default within the workload. If you plan to use MSBuild-based Linux projects instead of CMake, the workload installs those templates as well.
Setting Up Your Linux Machine
Visual Studio communicates with remote Linux machines over SSH and usesrsync/zip to synchronize header files. Install the required packages on your Linux target:
- Ubuntu / Debian (remote)
- Fedora (remote)
- Ubuntu on WSL
Connecting to a Remote Linux Machine via SSH
Open Connection Manager
In Visual Studio, go to Tools → Options → Cross Platform → Connection Manager.
Add a new connection
Click Add. The Connect to Remote System dialog appears.Fill in:
- Host name: IP address or hostname of the Linux machine (e.g.,
192.168.1.100) - Port:
22(default SSH port) - User name: Your Linux account username
- Authentication type: Password or Private Key
- Password / Private key file: Credentials for the account
Creating a Linux Project
Option A: MSBuild Linux Project
- File → New Project, search for Linux in the template filter.
- Select Console Application (Linux) and click Next.
- Enter a project name and location, then click Create.
- In Project Properties → General → Remote Build Machine, select your SSH connection.
| Template | Description |
|---|---|
| Console Application | Standard main() program targeting any Linux machine |
| Empty Project | Blank project, no sample code |
| Makefile Project | Wraps an existing Makefile-based build |
| CMake Project | CMake-driven build, recommended for cross-platform work |
Option B: CMake Linux Project (Recommended)
Open a folder containing aCMakeLists.txt. Visual Studio detects it automatically and offers Linux configurations. See the CMake Cross-Platform guide for a full CMakeLists.txt example.
A Simple Linux CMakeLists.txt
Building with GCC or Clang Remotely
Once your connection and project are configured, building works identically to a local project:- Press Ctrl+Shift+B or go to Build → Build Solution.
- Visual Studio copies source files to the remote machine via
rsync, runs the remote compiler (GCC or Clang), and retrieves error output back to the IDE Error List.
/usr/bin/clang++).
Visual Studio 2019 and later support both GCC and Clang for remote Linux builds. You can specify a specific version such as
/usr/bin/g++-12 or /usr/bin/clang++-16 in the compiler path.Debugging with GDB
Visual Studio uses GDB on the remote Linux machine as the debug backend, with the Visual Studio debugger UI as the front end. You get breakpoints, watch windows, call stacks, and variable inspection — all targeting the remote process.Set breakpoints
Click in the left gutter of any source file to set a red-dot breakpoint, just as you would for a Windows project.
Start debugging
Press F5 (or Debug → Start Debugging). Visual Studio compiles on the remote machine, deploys the binary, and launches
gdb remotely.Choose GDB mode
In Project Properties → Debugging, the Debugging Mode option selects between:
- gdb mode — Visual Studio drives GDB directly on the remote machine. Best compatibility.
- gdbserver mode — a local GDB client connects to
gdbserveron the remote. Faster for large binaries.
Separate Build and Debug Machines
You can cross-compile on an x64 Linux machine and deploy to an ARM device (e.g., a Raspberry Pi) for IoT scenarios:- Set the Remote Build Machine in Configuration Properties → General.
- Set a separate Remote Debug Machine in Configuration Properties → Debugging.
- Visual Studio copies only the necessary binaries to the debug target.
IntelliSense for Linux Headers
When you add or modify a connection, Visual Studio automatically extracts the remote compiler’s system headers (/usr/include, /usr/lib/gcc/...) to a local cache using rsync and zip. These headers power IntelliSense features (completions, Go to Definition, error squiggles) without requiring a local Linux installation.
To update the cache after installing new packages on the remote:
Tools → Options → Cross Platform → Connection Manager → select your connection → Update.
WSL Setup
Install WSL with
wsl --install and target it from Visual Studio with zero SSH configuration needed.CMake Linux Projects
Use CMake with Linux-Debug presets to share a single CMakeLists.txt across Windows and Linux builds.
Remote ARM Debugging
Cross-compile for ARM on an x64 host and deploy to Raspberry Pi or similar embedded Linux boards.
GDB Documentation
Reference for GDB commands available in the Additional Debugger Commands project property.