在Windows 7上使用带代码块的clang [英] Using clang with codeblocks on Windows 7

查看:247
本文介绍了在Windows 7上使用带代码块的clang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法使用Visual Studio 210在Windows 7上构建cl,现在我喜欢使用它与代码块IDE。所以我复制了铛可执行文件到MinGW的bin\文件夹,并更新了代码块的编译器设置使用叮当声,而不是GCC。



但是,当我编译Hello World示例我得到以下错误:

  || === clang_test,Debug === | 
obj\Debug\main.o:C:\Program文件(x86)\Microsoft的Visual Studio 10.0\VC\include\system_error | 447 |未定义的参考`的std :: iostream_category( )'|
obj\Debug\main.o:C:\Program文件(x86)\Microsoft的Visual Studio 10.0\VC\include\stdexcept | 170 |未定义的参考`的std ::例外: :exception(char const * const&)'|
|| === Build finished:2 errors,0 warnings === |

我想我必须使用clang的头文件,但是如何实现呢?



谢谢!

解决方案

UPDATE b
$ b

MSYS2软件包可用于32位和64位的clang,从有限的测试看,它似乎工作得很好。编译器可以在MSYS2环境之外使用。



有关如何安装MSYS2,请参阅此处。然后只需运行

  pacman -Sy mingw-w64-x86_64-clang 
pre>

  pacman -Sy mingw-w64-i686-更新MSYS2以安装Clang后,clang 



该软件包中使用的补丁(如果您想要自己构建LLVM / Clang)位于此处






/ em>



如果你想在Windows上使用C + +,你唯一的选择是使用(或构建自己)Clang with / for MinGW 。



幸运的是,我提供了包裹:





解压缩到同一目录,并添加 mingw32-dw2 / code>到 PATH ,或者指向Codeblocks。你将只能使用GCC 4.6的libstdc ++。锵3.2的C ++ 11语言支持功能齐全,但。



注意锵预计GCC风格的选择,所以我建议修改的代码块GCC编译过程和更换 gcc clang


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

pacman -Sy mingw-w64-x86_64-clang

or

pacman -Sy mingw-w64-i686-clang

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/bin to PATH, 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++ with clang++ and gcc with clang.

这篇关于在Windows 7上使用带代码块的clang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆