Getting Clang to work on windows
Solution 1:
There's some instructions for building clang
on this page (hidden in the "Clang Development" part of the sidebar...). For MinGW you want the section called "On Unix-like Systems". The only tricky part is step 5 which tells you how to set up the paths for the C++ standard library. These need to be added into the code in clang/lib/Frontend/InitHeaderSearch.cpp
. On my machine it wound up looking like this
// FIXME: temporary hack: hard-coded paths.
AddPath("/usr/local/include", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/mingw32", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/include/c++/backward", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../include", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/include", System, true, false, false);
AddPath("c:/msysgit/mingw/bin/../lib/gcc/mingw32/4.4.0/include-fixed", System, true, false, false);
though I'm not sure all these are needed!
Solution 2:
Depending on your version of MinGW
(and thus the version of gcc ported), the headers might be scattered a bit...
In the file clang/lib/Frontend/InitHeaderSearch.cpp
you will find a number of hard-coded paths. The trouble is that each is version specific, so if your version of MinGW is not in there, then feel free to add it (and ask for it to be integrated in Clang's mainline by posting the patch to cfe-commit).
Personally I run it on MinGW/msys with only minor issues (a number of test cases fail because my msys shell mangles the input when there are :
in...), I have not tried using it from CodeBlocks though (I'm used to the command line).
If you wish to help, Takumi is watching over MinGW integration, Francois Pichet is leading the work on compatibility with VC++/MFC headers (ie is the main contributor) and @rubenvb is currently trying to push patches on libc++ to have it working on Windows (libc++ does not compile on Windows yet). The 3 areas are pretty much independent and require different skills and knowledge.