Microsoft C++ (MSVC) is not a single tool but a complete, integrated toolset for building native C and C++ applications on Windows. When developers refer to “MSVC,” they typically mean the combination of theDocumentation 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.
cl.exe compiler, the link.exe linker, the C++ Standard Library, the C Runtime Library (CRT), the Visual Studio debugger, and a suite of companion utilities — all of which ship together as part of Visual Studio and the standalone Microsoft C++ Build Tools. Understanding each component and how they interlock is key to using the toolset effectively.
The MSVC Compiler: cl.exe
cl.exe is the Microsoft C and C++ compiler driver. It accepts .c and .cpp source files and produces COFF-format object files (.obj) that the linker can combine into executables or libraries. A single invocation of cl.exe can also invoke the linker automatically, making it easy to compile-and-link in one step.
cl.exe include:
- C++ standards support —
/std:c++14,/std:c++17,/std:c++20,/std:c++latestselect the language standard. MSVC tracks the ISO standard closely and publishes a conformance table for each release. - Optimization levels —
/Od(debug, no optimization),/O1(minimize size),/O2(maximize speed),/Ox(full optimization). Whole-program optimization (/GL) combined with link-time code generation (/LTCG) enables cross-module inlining. - Security mitigations —
/GS(buffer security checks),/guard:cf(control-flow guard),/Qspectre(Spectre mitigation), and/sdl(additional security development lifecycle checks). - Diagnostics —
/W0through/W4and/Wallcontrol warning verbosity./analyzeenables static analysis./diagnostics:caretshows the precise token that caused an error. - Precompiled headers —
/Yccreates a precompiled header;/Yuuses one. This dramatically reduces rebuild times in large projects.
The Linker: link.exe
link.exe combines object files and library files into a final output — an executable (.exe), a dynamic-link library (.dll), or a static library (.lib). It reads .obj files produced by cl.exe and resolves cross-file symbol references.
- Incremental linking (
/INCREMENTAL) — only re-links changed sections, dramatically speeding up edit-build-debug cycles. - Profile-guided optimization (
/PGO) — uses profiling data collected from real workloads to reorganize code for better CPU cache utilization. - Control-flow guard (
/guard:cf) — inserts runtime checks that prevent attackers from redirecting execution through function pointers. - COMDAT folding (
/OPT:ICF) — merges identical functions and data to reduce binary size. - Delay-load imports (
/DELAYLOAD) — defers loading of DLLs until the first call into them.
The C++ Standard Library
MSVC ships a complete implementation of the ISO C++ Standard Library. This includes all headers mandated by C++11 through C++23, such as<algorithm>, <vector>, <string>, <filesystem>, <ranges>, <format>, <coroutine>, and <print>. The Standard Library implementation is developed openly on GitHub (microsoft/STL) and is updated with every Visual Studio release.
The Standard Library is a header-only interface backed by compiled static or import libraries (e.g.,
msvcprt.lib). You never need to manually link these; the compiler inserts the correct #pragma comment(lib, ...) directives automatically.The C Runtime Library (CRT)
The Microsoft C Runtime Library provides the foundational C runtime functions: memory allocation (malloc/free), standard I/O (printf, fopen), string manipulation, math functions, and process initialization. Since Windows 10, the core CRT — the Universal CRT (UCRT) — ships as part of Windows itself (ucrtbase.dll). The Visual C++ CRT adds compiler-specific extensions on top.
The CRT comes in several flavors selected by compiler switches:
| Switch | Runtime | Description |
|---|---|---|
/MT | libcmt.lib | Static CRT, release build |
/MTd | libcmtd.lib | Static CRT, debug build |
/MD | msvcrt.lib | Dynamic CRT, release build |
/MDd | msvcrtd.lib | Dynamic CRT, debug build |
The Debugger
The Visual Studio native debugger provides a first-class debugging experience for MSVC-compiled code. It integrates directly with the IDE and supports:- Breakpoints and conditional breakpoints — pause execution at any line or when a boolean expression becomes true.
- Data breakpoints — break when the value at a memory address changes.
- Watch, Autos, and Locals windows — inspect and modify variable values live while paused.
- Call stack inspection — navigate up and down the call stack and examine local state at each frame.
- Edit and Continue — modify source code while the process is running and apply changes without restarting (requires
/ZIcompile flag). - Just My Code — skip over framework and library code when stepping, focusing only on your own source.
- Remote debugging — attach to a process running on a remote Windows machine or a Linux machine over SSH.
The Profiler
Visual Studio includes a performance profiler accessible from Debug > Performance Profiler. It provides several analysis tools:CPU Usage
CPU Usage
Samples the call stack at regular intervals to show which functions consume the most CPU time. Useful for finding hot paths in computationally intensive code.
Memory Usage
Memory Usage
Takes heap snapshots and shows object allocations over time. Identifies memory leaks and excessive allocation pressure.
Instrumentation
Instrumentation
Inserts timing probes around every function call to produce exact elapsed-time measurements. Higher overhead than sampling but gives precise data.
Toolset Versions and Visual Studio Releases
MSVC toolset versions are identified by av1xx number that maps to a Visual Studio release. The toolset version determines the compiler ABI, the Standard Library version, and which language features are available.
| Visual Studio Version | Toolset Version | Compiler Version (_MSC_VER) |
|---|---|---|
| Visual Studio 2015 | v140 | 1900 |
| Visual Studio 2017 | v141 | 1910–1916 |
| Visual Studio 2019 | v142 | 1920–1929 |
| Visual Studio 2022 | v143 | 1930–1944+ |
Standalone Build Tools
If you need the MSVC compiler without the full Visual Studio IDE, Microsoft provides the Microsoft C++ Build Tools as a separate download. This installscl.exe, link.exe, the Standard Library, the Windows SDK, and MSBuild — everything needed to build C++ projects from the command line or in CI/CD pipelines — without installing the IDE.
The Developer Command Prompt for VS (or vcvarsall.bat) sets up the environment variables (PATH, INCLUDE, LIB, LIBPATH) needed to use the build tools from any command prompt window.