DEV Community

Cover image for How to Install the New Version of Clang/LLVM on Windows
Marcos Oliveira
Marcos Oliveira

Posted on

How to Install the New Version of Clang/LLVM on Windows

We already made this post about installing Clang, but it became obsolete. In this quick article, we’ll see how to do it easily.


Installation

If you installed the version from the other article

First, remove the directory and also the path from the environment variable.

Open PowerShell as administrator.

Remove the installation:

Remove-Item -Path "C:\Users\$env:USERNAME\.utils" -Recurse -Force
Enter fullscreen mode Exit fullscreen mode

Remove the environment variable:

[Environment]::SetEnvironmentVariable("Path", (
    ($env:Path -split ";") -ne "C:\Users\Marcos\.utils\llvm-mingw\bin" -join ";"
), [System.EnvironmentVariableTarget]::Machine)
Enter fullscreen mode Exit fullscreen mode

Installing Clang/LLVM MinGW

This version does not depend on MSVC.

Just use WinGet:

winget install --id=MartinStorsjo.LLVM-MinGW.UCRT  -e
Enter fullscreen mode Exit fullscreen mode

Still with admin rights, run this command:

[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\LLVM\bin", "Machine")
Enter fullscreen mode Exit fullscreen mode

Close the terminal, reopen it and check the version:

clang++ --version
Enter fullscreen mode Exit fullscreen mode

There is also the MSVC version, but to have both installed you need to rename one of the paths and add it to PATH, just use the WinGet command for it:

winget install --id=LLVM.LLVM  -e
Enter fullscreen mode Exit fullscreen mode

If you had conflicts, uninstall with: winget uninstall --id=LLVM.LLVM


Difference Between Versions

--id=LLVM.LLVM

Official Microsoft and LLVM version.

  • Installs the official LLVM distributed by the LLVM Foundation.
  • Includes tools like:

    • clang, clang++ (C/C++ compilers)
    • lld (linker)
    • lldb (debugger)
    • clang-format, clang-tidy, etc.

Main uses:

  • Modern C/C++ development on Windows, Linux, or macOS.
  • Replacing MSVC (Visual C++) in cross-platform projects.
  • When you want to compile for native Windows with Clang + MSVC.

By default, it uses the Visual Studio (MSVC) toolchain as backend on Windows (for linking, runtime, etc).


--id=MartinStorsjo.LLVM-MinGW.UCRT

  • Installs the LLVM-MinGW distribution, maintained by Martin Storsjö.
  • Uses Clang + MinGW linker + runtime (no Visual Studio dependency).
  • Based on the UCRT (Universal C Runtime), making executables more modern and compatible.

Main uses:

  • Compile Windows apps using LLVM without needing Visual Studio.
  • Produce binaries completely free of MSVC dependencies.
  • Ideal for cross-platform development, CI/CD automation, and cross-compilation (e.g., compiling Windows from Linux).

Includes:

  • clang, lld, libc++, libunwind, MinGW headers/libraries (with UCRT)
  • Pre-configured tools to compile directly for Windows

Quick Comparison:

Feature LLVM.LLVM (Official) LLVM-MinGW.UCRT (Martin Storsjö)
Maintained by LLVM Foundation Martin Storsjö
Default backend on Windows MSVC (Visual Studio) MinGW + UCRT
Requires Visual Studio? Yes (for linking, by default) No
Main target Windows (with MSVC) Windows (without MSVC)
Typical use IDEs like VSCode with Clang Cross-compiling, portable builds
License Permissive (LLVM) Permissive (LLVM + MinGW UCRT)

  • If you already use Visual Studio or want MSVC ecosystem integration: Use LLVM.LLVM.
  • If you want a complete, MSVC-independent toolchain (especially useful for scripts, CI/CD, or cross-compilation): Use MartinStorsjo.LLVM-MinGW.UCRT.

See also:

Top comments (0)