clang/clang++ doesn't find C/C++ headers in windows? clang/clang++ doesn't find C/C++ headers in windows? c c

clang/clang++ doesn't find C/C++ headers in windows?


The current method to do it is...

When asked, default paths. Place them both in your system path (accessible for all users). The Clang installer will put clang in the path if you ask it to, for Mingw, you have to do it manually, I recommend PathEditor2. For the current version of Mingw, the directory to add to your path is C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\bin

Then when invoking Clang, use...

clang -target x86_64-pc-windows-gnu test.c -otest.exe

Clang will search your path to find the Mingw headers and libraries, make sure you only have one version in your path.


We attempted to run the test of Clang as described in llvm.org/docs/GettingStartedVS.html. That procedure failed for similar reasons indicating that stdio.h was not found. Attempting installation on another machine it was successful. We ran a few verbose runs to identify the difference between the machines using "-v" flag for a verbose description of the linking process.

We found that the working installation had the default mapping of Windows System32 directory (C:\Windows\System32) in the path variables. The failing machine did not have that path mapped. We added the path to the failing machine and everything worked.

This may have been a change implemented by system administrators for security reasons. If adding the path is not allowed, add “-isystem C:\file\location\here” to the clang command for each file you wish to include.