I have installed LLVM and Clang-3.9.0 on Win10. I have MinGW installed as well.
I have put my C code in 'D:' drive.
I can use gcc and g++ to compile my code. But when I use clang I get:
clang -cc1 version 3.9.0 based upon LLVM 3.9.0 default target x86_64-pc-windows-msvc
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
ignoring duplicate directory "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A"
#include "..." search starts here:
#include <...> search starts here:
C:\Program Files\LLVM\bin\..\lib\clang\3.9.0\include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A
End of search list.
hello.c:1:10: fatal error: 'stdio.h' file not found
#include "stdio.h"
^
1 error generated.
As I can use gcc and g++, my environment variable settings are right. But then I am not able to force clang to look into C:\MinGW.
I tried copy pasting the whole MinGW folder manually in C:\Program Files\LLVM\bin\
and \lib\clang\3.9.0\include
separately, but it did not work. I wanted to try this, but in 3.9.0 I cannot find, clang/lib/Frontend/InitHeaderSearch.cpp
.
Anyway, is there a work around?
Note: I have tried <stdio.h>
and "stdio.h"
both, and I still get the same error.
Okay, so until now things with Clang/LLVM in Windows. Starting 3.7 or so things have changed: Clang/LLVM binaries are built with Visual Studio and for Visual Studio. No need for MinGW, as far as I understand.
So now install LLVM via the binary files available. Make sure that you have VS2015 (or 2013 and more) previously installed. When LLVM is being installed add it in the path when prompted.
Now after all that has been done, start the developer commander prompt for VS2015 (got to start -> Visual Studio 2015 -> Developer Commander Prompt for VS2015. I guess, you will choose whatever suits for your requirements). Now from here try using the clang commands listed on LLVM website.
However commands like lli
, llvm-dis
and llc
still cannot be ran.
Also, LLVM website still says that GNU tools for windows are needed. But I do not know what for!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With