We already made this post about installing Clang, but it became obsolete. In this quick article, we’ll see how to do it easily.
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
Remove the environment variable:
[Environment]::SetEnvironmentVariable("Path", (
($env:Path -split ";") -ne "C:\Users\Marcos\.utils\llvm-mingw\bin" -join ";"
), [System.EnvironmentVariableTarget]::Machine)
This version does not depend on MSVC.
Just use WinGet:
winget install --id=MartinStorsjo.LLVM-MinGW.UCRT -e
Still with admin rights, run this command:
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\LLVM\bin", "Machine")
Close the terminal, reopen it and check the version:
clang++ --version
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
If you had conflicts, uninstall with:
winget uninstall --id=LLVM.LLVM
--id=LLVM.LLVM
Official Microsoft and LLVM version.
Includes tools like:
clang
, clang++
(C/C++ compilers)lld
(linker)lldb
(debugger)clang-format
, clang-tidy
, etc.Main uses:
By default, it uses the Visual Studio (MSVC) toolchain as backend on Windows (for linking, runtime, etc).
--id=MartinStorsjo.LLVM-MinGW.UCRT
Main uses:
Includes:
clang
, lld
, libc++
, libunwind
, MinGW headers/libraries (with UCRT)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) |
LLVM.LLVM
.MartinStorsjo.LLVM-MinGW.UCRT
.