windows上使用clang编译程序

环境:windows7,64位

1、下载并安装llvm,安装包里除了llvm,也有clang:

http://releases.llvm.org/5.0.0/LLVM-5.0.0-win64.exe

2、下载并安装mingw:

https://sourceforge.net/projects/mingw-w64/

安装时选择CPU架构为 x86_64

把安装路径添加到path中:

C:Program Filesmingw-w64x86_64-7.1.0-posix-seh-rt_v5-rev2mingw64in

3、打开命令行窗口,开始编译程序:

clang --target=x86_64-pc-mingw64 hello.c -o hello.exe

原文地址:https://www.cnblogs.com/lavezhang/p/7544238.html