I have managed to build clang on Windows 7 using Visual Studio 210 and now I like to use it with the codeblocks IDE. So I copied the clang executables into the mingw bin\ folder and updated the codeblock’s compiler settings to use clang instead of gcc.
But when I compile the hello world example I get the following errors:
||=== clang_test, Debug ===|
obj\Debug\main.o:c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\system_error|447|undefined reference to `std::iostream_category()'|
obj\Debug\main.o:c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdexcept|170|undefined reference to `std::exception::exception(char const* const&)'|
||=== Build finished: 2 errors, 0 warnings ===|
I guess I have to use clang’s header files but how to I accomplish that?
Thanks!
UPDATE
MSYS2 packages are available for clang on 32-bit and 64-bit, and from what limited testing I did it seems to work quite well. The compiler can be used from outside the MSYS2 environment.
On how to install MSYS2, see here. Then just run
or
after updating MSYS2 to install Clang.
The patches used in that package (if you want to build LLVM/Clang yourself) are located here.
old reply follows, slightly out of date
If you want to use Clang on Windows for C++, your only option currently is to use (or build yourself) Clang with/for MinGW(-w64).
Lucky for you, I provide packages:
Unzip both to the same directory and add
mingw32-dw2/bintoPATH, or point Codeblocks to it. You will be limited to GCC 4.6’s libstdc++. Clang 3.2’s C++11 language support is fully functional though.Note that Clang expects GCC style options, so I suggest modifying the Codeblocks GCC build process and replacing
g++withclang++andgccwithclang.