On Windows, Clang is not self-sufficient, and is supposed to be used in combination with an other compiler: either MinGW (GCC) or MSVC. Clang is going to use the standard library (and other libraries/headers) of that compiler, since it doesn't ship with ones of its own.

If you want to use it with MSVC and have it installed, running clang-cl instead of cl should just work.

But since you mentioned VSC, I assume you don't want MSVC. Then...

If you want to use it with MinGW and have it installed, use clang --target=x86_64-w64-windows-gnu instead of gcc, and it should also just work. (That's assuming your MinGW produces 64-bit apps. Replace x86_64 with i686 if it's 32-bit.)

If you don't have MinGW yet, you can get a fresh version from MSYS2. Then you have an option to install their unofficial build of Clang instead of the regular one, which has an advantage of using --target=x86_64-w64-windows-gnu automatically (so you don't have to write it manually).

Answer from HolyBlackCat on Stack Overflow
Top answer
1 of 3
21

On Windows, Clang is not self-sufficient, and is supposed to be used in combination with an other compiler: either MinGW (GCC) or MSVC. Clang is going to use the standard library (and other libraries/headers) of that compiler, since it doesn't ship with ones of its own.

If you want to use it with MSVC and have it installed, running clang-cl instead of cl should just work.

But since you mentioned VSC, I assume you don't want MSVC. Then...

If you want to use it with MinGW and have it installed, use clang --target=x86_64-w64-windows-gnu instead of gcc, and it should also just work. (That's assuming your MinGW produces 64-bit apps. Replace x86_64 with i686 if it's 32-bit.)

If you don't have MinGW yet, you can get a fresh version from MSYS2. Then you have an option to install their unofficial build of Clang instead of the regular one, which has an advantage of using --target=x86_64-w64-windows-gnu automatically (so you don't have to write it manually).

2 of 3
13
  1. Install Clang using Visual Studio Installer.
    (1) Open 'Visual Studio Installer'.
    (2) Visual Studio Community 2022 -> click 'Modify'
    (3) In the [Installation details] checkbox list, check 'C++ Clang tools for Windows'
    (4) Install.

  2. Add clang.exe (created by the above procedure) to the Path environment variable.

  3. Now try clang --version in the terminal.

Great, you're good to go :)


Edit: If you didn't change the default installation path, clang.exe should likely be in C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm such as (for x64) C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin.

🌐
LLVM
releases.llvm.org › download.html
LLVM Download Page
Clang for x86_64 Darwin 10.9 (.sig) Clang for x86_64 Fedora 20 (.sig) Clang for x86_64 OpenSUSE 13.1 (.sig) Clang for x86_64 Ubuntu 12.04 (.sig) Clang for ARMv7a Linux (.sig) Clang for Windows (.sig) Please read the LLVM Release Notes and Clang Release Notes before downloading : Sources: Clang source code (.sig) LLVM source code (.sig) Compiler RT source code (.sig) Dragonegg source code (.sig) LibC++ source code (.sig) LLDB source code (.sig) LLD source code (.sig) Polly source code (.sig) Clang Tools Extra (.sig) LLVM Test Suite (.sig) Pre-built Binaries: Clang for Windows (.sig) Clang for D
Discussions

How do I install latest Clang for VSCode? (On Windows10)
TLDR: Install clang via llvm from LLVM releases + add it to paths Install MSVC STL, the easiest solution is to install VS Community | VS Build-tools. Install Windows Developer SDK (easiest way, same as 2.) Install cmake and ninja-build (possible via VSInstaller, but I prefere standalones) and add them to the path) Install VSCode, cmake-tools plugin, optionally c++plugin package and clangd Setup a clang-cl cmake-kit ("environmentSetupScript") to auto load the env via vcvars64.bat Setup the cmake-tools to use "Ninja" as Generator (same as calling cmake -GNinja ) run cmake via VSCode, profit or ask follow-up questions. As you wrote, you can download the most recent version from https://github.com/llvm/llvm-project/releases . It will require a c++ STL when you want to compile C++ with an STL. And it will require the paths to the UCRT library to link against C and Windows API. There are several ways to set those paths up, just like in linux. The easiest is, to just run the VS Developer console and do the compilation via the terminal. The second best, if you want to use VS Code: install the CMake-tools plugin and then configure your kit, that it runs a script from VSComunity/Buildtools via the environmentSetupScript option: { "name": "Clang-cl toolchain vcpkg", "compilers": { "C": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", "CXX": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe" }, "toolchainFile": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake", "environmentSetupScript": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "isTrusted": true } The paths set by the script are also set by the developer console, and you can set it into your global path. But this might interfere, if you also have MSYS installed, don't do that unless you are in a special clang-cl only VM. Another rather advanced approach is, to write a cmake toolchain or presets file, which sets the paths. More on reddit.com
🌐 r/cpp_questions
4
3
March 8, 2025
CLANG download and install
Usually it varies based on your platform. here you'll have an answer: https://releases.llvm.org/download.html or https://github.com/llvm/llvm-project/releases For windows I'd suggest you use minigw compiled clang: https://github.com/mstorsjo/llvm-mingw/releases easier to debug. More on reddit.com
🌐 r/cpp_questions
13
3
February 27, 2025
c++11 - What do you need to install to use Clang on windows to build c++14 for 64 bit? - Stack Overflow
I've tried to follow this tutorial: ...g-3-5-for-windows - and was able to use it to get clang to build and link (using gcc 4.8.2), but the resulting binaries were 32 bit. I've tried installing the latest prebuilt binaries of clang (3.6.2) and the 64 bit version of mingw-w64 (4.9.3 for 64 bit with posix and sjlj for exceptions), and am getting: hello.cpp:1:10: fatal error: ... More on stackoverflow.com
🌐 stackoverflow.com
Easy way to install latest Clang on Windows?
I got the official installer from the LLVM website but not only VS2022 doesn't detect it, VS Code doesn't either. I tried looking for info on Google but got no luck First check whether it works by compiling a small "Hello World" program using the command line interface in a console. Does it work? Great, then it's installed correctly. Then the problem is with the IDE/Editor which is completely different from LLVM/Clang. IDEs and editors can't just figure out if any and all software is installed on your computer. You could literally install it in any directory or even on a USB drive that you only once in a while plug in. Some smart IDEs will look for well-known compilers in common installation directories, but some times there is no "common directory" - you need to tell it where to look. Look in the IDE/Editor documentation: https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170 For VS code it depends on what build plugin you use. If you use the default task.json configuration you simply need to specify paths manually. If you use CMake and the CMakeTools extension you can define CMakePresets: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html More on reddit.com
🌐 r/cpp_questions
12
12
November 1, 2023
🌐
Reddit
reddit.com › r/cpp_questions › easy way to install latest clang on windows?
r/cpp_questions on Reddit: Easy way to install latest Clang on Windows?
November 1, 2023 -

I've been trying to install the latest version of Clang (17.01) on Windows 10 without resorting to MinGW or similar, and without using the VS2022 installer 'cause it still uses v16.

I got the official installer from the LLVM website but not only VS2022 doesn't detect it, VS Code doesn't either. I tried looking for info on Google but got no luck.

🌐
Clang
clang.llvm.org › get_started.html
Getting Started: Building and Running Clang - LLVM.org
Get it from: https://git-scm.com/download or install the component Git For Windows bundled with Visual Studio. In addition to source code control, the GNU core utilities in the package are used by the tests. CMake. This is used for generating Visual Studio solution and project files.
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › how to install clang on windows - wikihow
How to Install Clang on Windows - wikiHow
December 19, 2025 - 1. Go to https://visualstudio.microsoft.com/vs/preview/. 2. Click Download Preview under "Community." 3. Open the downloaded file. 4. Click Continue. 5. Click to check the box next to Desktop development with C++. 6. Click to check the box next ...
🌐
Wetmelon
wetmelon.github.io › clang-on-windows.html
Using Clang on Windows for C++
Clang can be used on Windows, and LLVM provides releases on their website: https://releases.llvm.org/download.html
🌐
DEV Community
dev.to › marcosplusplus › how-to-install-the-new-version-of-clangllvm-on-windows-2flb
How to Install the New Version of Clang/LLVM on Windows - DEV Community
May 30, 2025 - By default, it uses the Visual Studio (MSVC) toolchain as backend on Windows (for linking, runtime, etc). Installs the LLVM-MinGW distribution, maintained by Martin Storsjö. Uses Clang + MinGW linker + runtime (no Visual Studio dependency).
Find elsewhere
🌐
Medium
medium.com › @swargarajd › installing-clang-formatter-in-visual-studio-code-for-windows-9a4fc882785c
Installing Clang Formatter in Visual Studio Code (For Windows) | by Swargarajd | Medium
August 19, 2023 - Installing Clang Formatter in Visual Studio Code (For Windows) Hey guys, in this blog I will take you through all the steps you need to download and install clang formatter in your Visual Studio …
🌐
Reddit
reddit.com › r/cpp_questions › how do i install latest clang for vscode? (on windows10)
r/cpp_questions on Reddit: How do I install latest Clang for VSCode? (On Windows10)
March 8, 2025 -

I'm beginner, wanting to use VSCode (Visual Studio Code) for C++ projects. I want to try Clang. GCC I have already installed and tried successfully (via MinGW/MSYS). I'm confused about Clang installation though. If I understand correctly, installing latest Clang (from https://github.com/llvm/llvm-project/releases or what not) is alone not enough. That it is "just" the compiler and it needs other things to work, so it has to rely on stuff from either MSVC or MinGW. So what do I do to make it work? (without messing up my current installation of Visual Studio (not VSCode) and the MinGW installation which I want to use for GCC. I want to try the latest stable release if possible so the version in VisualStudio is no good.)

Top answer
1 of 4
5
TLDR: Install clang via llvm from LLVM releases + add it to paths Install MSVC STL, the easiest solution is to install VS Community | VS Build-tools. Install Windows Developer SDK (easiest way, same as 2.) Install cmake and ninja-build (possible via VSInstaller, but I prefere standalones) and add them to the path) Install VSCode, cmake-tools plugin, optionally c++plugin package and clangd Setup a clang-cl cmake-kit ("environmentSetupScript") to auto load the env via vcvars64.bat Setup the cmake-tools to use "Ninja" as Generator (same as calling cmake -GNinja ) run cmake via VSCode, profit or ask follow-up questions. As you wrote, you can download the most recent version from https://github.com/llvm/llvm-project/releases . It will require a c++ STL when you want to compile C++ with an STL. And it will require the paths to the UCRT library to link against C and Windows API. There are several ways to set those paths up, just like in linux. The easiest is, to just run the VS Developer console and do the compilation via the terminal. The second best, if you want to use VS Code: install the CMake-tools plugin and then configure your kit, that it runs a script from VSComunity/Buildtools via the environmentSetupScript option: { "name": "Clang-cl toolchain vcpkg", "compilers": { "C": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe", "CXX": "C:\\Program Files\\LLVM\\bin\\clang-cl.exe" }, "toolchainFile": "C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake", "environmentSetupScript": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "isTrusted": true } The paths set by the script are also set by the developer console, and you can set it into your global path. But this might interfere, if you also have MSYS installed, don't do that unless you are in a special clang-cl only VM. Another rather advanced approach is, to write a cmake toolchain or presets file, which sets the paths.
2 of 4
2
On Windows, the easiest way to install Clang: open a terminal and type: winget install -e --id LLVM.LLVM
🌐
SourceForge
sourceforge.net › projects › clangonwin
ClangOnWin download | SourceForge.net
ClangOnWin
Download ClangOnWin for free. Build Clang On Windows. The clang binary release Windows-based, Autobuilder https://github.com/fstudio/clangbuilder The author's network is not very good, so will not upload the build package in time, you can use Clangbuilder to build clang The clang binary release Windows-based, · Autobuilder https://github.com/fstudio/clangbuilder · The author's network is not very good, so will not upload the build package in time, you can use Clangbuilder to build clang
Rating: 5 ​
🌐
LLVM
llvm.org › builds
LLVM Snapshot Builds
Windows installer (64-bit) (.sig), based on Git commit 6923b0a7 (28 August 2020). If there is a previous version installed, the installer provides an option to uninstall it. Currently, the package includes clang, clang-format, lld, and the AddressSanitizer runtime from compiler-rt.
🌐
Johannesmp
blog.johannesmp.com › 2015 › 09 › 01 › installing-clang-on-windows-pt2
Installing clang++ to compile and link on Windows : Part 2 · Johannes Peter
September 1, 2015 - clang++.exe should be located in C:\Program Files\LLVM\bin, which should be in your system PATH. ... Download Link - clang 3.7.0 32 bit.
🌐
Terminal Root
terminalroot.com › how-to-install-clang-on-windows-with-a-single-command
How to Install Clang on Windows with a Single Command
July 23, 2024 - In this article we will see that you can install Clang/Clang++ on Windows with a single command. In addition to having all the tools also available, such as: ... And all the others! First make sure you don’t have clang installed. Open PowerShell and run the command: ... If the output that the term is not recognized (it is colored red). The command below must be used in PowerShell. powershell -Exec ByPass -NoProfile -c "(New-Object Net.WebClient).DownloadString('https://tinyurl.com/llvm-mingw') | IEX"
🌐
Ariya
ariya.io › 2020 › 01 › clang-on-windows
Clang on Windows · ariya.io
January 5, 2020 - MSYS2 is a fantastic (and better) reimagination of Cygwin, it is like taking the best part of a typical modern Unix environment (a familiar shell, a general collection of utilities, a porting layer, a package manager, and so on) while still working on Windows. Bootstrapping into MSYS2 is easy, either install it directly (using the GUI installer) or use Chocolatey: choco install msys2. Once inside its shell, pacman is the go-to, ever-so-powerful package manager, with thousands of packages available at your disposal. This of course, includes the toolchain. Not only the latest GCC is there, but we also have Clang!
🌐
WinLibs
winlibs.com
WinLibs - GCC+MinGW-w64 compiler for Windows
Don't worry. For most purposes the latest Windows 64-bit release version with MSVCRT runtime and POSIX threads is a good choice. Download it here. GCC 16.1.0 (with POSIX threads) + MinGW-w64 14.0.0 (UCRT) - release 3 (LATEST) Win32 (without LLVM/Clang/LLD/LLDB): 7-Zip archive* | Zip archive