DEV Community

alok-38
alok-38

Posted on

How to Install Visual Studio MSVC Compiler on Windows 11 for C Programming — Minimal Steps

Visual Studio’s full installation can be quite large—often several gigabytes—which can be overwhelming if all you need is just the MSVC compiler for C programming. In this post, I’ll show you how to set up a minimal Visual C++ compiler toolchain on Windows 11 without installing the entire Visual Studio IDE.

The set up

After downloading the vs_BuildTools.exe executable, you will be presented with this.

Image description

Choose Desktop Development with C++ and only check MSVC and Windows 11 SDK and choose the destination where you want to install and click the Install while Downloading button. Once the installation is complete, you will see this.

Image description

Click the *launch * button and you a developer command prompt window will pop up.
type where cl and you should see the following.

Image description

This output confirms a successful installation and that the environment is set up correctly.

Compiling a C Program

Compiling a program is as simple as typing cl test.c or whatever the name of your file is and if you notice this
Image description

you have successfully compiled your program. Now run it (execute) by typing .\test.exe

Top comments (0)