Build & debug C++ on WSL 2 with Visual Studio 2022 and VS Code. In this step-by-step guide you’ll enable WSL 2, install the Linux toolchain (GCC/GDB/Ninja/CMake), create a CMake project, and debug seamlessly from Windows 11 using Visual Studio 2022, 2026, and VS Code (Remote-WSL). We’ll cover CMake Presets, selecting the WSL target in VS, and running/debugging from the Linux filesystem.
#C++ #WSL2 #VisualStudio #VSCode #CMake #Windows11
You’ll learn
• Enable WSL 2 and install a distro (Ubuntu shown)
• Setup Visual Studio 2022/2026 for cross-platform C++ development
• Install build tools: g++, gdb, ninja-build, cmake
• Create a CMake project and configure CMake Presets
• Build & debug in Visual Studio 2022/2026 and VSCode
Applies to:
✅ Windows 11, Windows 10
✅ Windows Server 2016—2025
✅ Visual Studio 2022 & 2026
✅ Visual Studio Code 1.105+
Commands and Scripts (PowerShell & BASH) GitHub:
https://github.com/DariensTips/Build-...
https://github.com/DariensTips/Build-...
Chapters:
0:00 Introduction
0:22 Prepare
0:32 Prepare: Visual Studio
1:06 Prepare: Visual Studio Code
1:31 Visual Studio 2022/2026
3:34 Visual Studio Code
4:58 Install CMake Manually
6:19 Thank you for watching
6:42 Links & Resources
Links & Resources:
https://cmake.org/download/
https://code.visualstudio.com/docs/cp...
https://code.visualstudio.com/download
https://learn.microsoft.com/en-us/cpp...
https://learn.microsoft.com/en-us/vis...
https://visualstudio.microsoft.com/do...
https://www.vecteezy.com/video/204322...
Glossary:
WSL = Windows Subsystem for Linux
IDE = Integrated Development Environment
C++ = C Plus Plus (language)
VSCode = Visual Studio Code
CMake = Cross-platform build system
GDB = GNU Debugger
MSVC = Microsoft Visual C++ toolchain
GCC = GNU Compiler Collection
Related videos and Playlists:
• Windows Subsystem for Linux, WSL Installat...
• Windows
Attribution:
Fireworks: https://www.vecteezy.com/video/204322...