I have both MinGW gcc
and Clang clang
installed and added to path via chocolatey
, and both can be found on the command line. However, when I try to use clang
with gcc
, clang
doesn't seem to know where to find header files in the standard library (such as iostream
), returning the following error:
clang++ -v main.cpp -o main.exe -std=c++14 -target x86_64-mingw64
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-unknown-windows-gnu
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
(SKIP)
ignoring nonexistent directory "(nonexistent directories)"
#include "..." search starts here:
#include <...> search starts here:
C:\Program Files\LLVM\lib\clang\9.0.0\include
End of search list.
main.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
shell returned 1
I've added both gcc
and clang
to path, as well as the directory containing header files included in gcc
(C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\lib\gcc\x86_64-w64-mingw32\8.1.0
), so I don't understand why clang
isn't looking in the right place for the header files. How can I fix this problem? And this isn't really necessary, but can the default target for clang
be changed? The current Windows 10 default for clang
is msvc
, but I'd rather not use it.