[cfe-dev] Any tutorial or resource on getting a working CLang environment under Windows?

Eli Friedman eli.friedman at gmail.com
Fri Dec 21 20:44:02 PST 2012


On Fri, Dec 21, 2012 at 8:28 PM, greatwolf <clang.greatwolf at mamber.net> wrote:
> In particular, I'm not looking to build llvm or clang from source but rather
> how to use the precompiled binary made available from llvm's download
> section under mingw windows setup.
>
> At the moment I downloaded the latest provided 3.2 Clang Mingw experimental
> binary. However, when trying to compile a test program with clang++ it isn't
> looking in the right place for the mingw header includes, libstdc++,
> win32api and the like.
>
> I would get silly errors like:
>
> main.cpp:1:10: fatal error: 'iostream' file not found
> #include <iostream>
>          ^
> 1 error generated.
>
> What's the recommended way to correct this problem? Adding '-I' for mingw's
> header location might be one way but there has to be a better way to tell
> clang on where to look for this by default.

clang first looks relative to itself for MinGW (i.e. where the headers
would be if you installed clang into MinGW).  Then, it tries
"/mingw/include" and "c:/mingw/include".

> Secondly, what linker does Clang use? Does it try to use the default gnu ld
> linker from mingw? Does Clang come with its own linker? What is llvm-link
> for?
>
> Thanks in advance for clarifying.

At the moment, on MinGW clang invokes gcc to link. llvm-link is not a
linker in the sense you care about; http://lld.llvm.org is, but that's
not yet usable.

-Eli



More information about the cfe-dev mailing list