clang/clang++ 在 windows 中找不到 C/C++ headers?

clang/clang++ doesn't find C/C++ headers in windows?

1 小时前我从 http://llvm.org/pre-releases/3.6.0/ 下载了 llvm-3.6.0-rc4-win32.exe .

我试图编译只打印 "hello" 的简单 C 代码,但它没有编译,因为 clang.exe 找不到 stdio.h。 当我使用具有相同代码的 clang-cl.exe 时,它​​起作用了。

即使使用 iostream,我对 clang++ 也有同样的问题,我将 -I 标志添加到 GCC (4.9.1) C++ headers,结果:

C:\Users\One\Desktop>clang++ -I c:\MinGW\x86_64-w64-mingw32\include\c++ main.cpp -lib=libstdc++

In file included from main.cpp:1:
c:\MinGW\x86_64-w64-mingw32\include\c++\iostream:38:10: fatal error:'bits/c++config.h' file not found

#include <bits/c++config.h>
1 error generated.

有人知道如何解决这个问题吗?

编辑: 我在 MinGW 文件夹中找到 bits/c++config.h 我将它添加到 -I 标志和其他 .

我得到一个 link 错误:

C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lib=libstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libstdc++.dll.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/\libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libstdc++.dll.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1\libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libstdc++.dll.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libstdc++.dll.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libstdc++.a when searching for -lstdc++
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lstdc++
    C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/\libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libgcc.a when searching for -lgcc
    C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1\libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmoldname
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmingwex
    C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libpthread.dll.a when searching for -lpthr
ead
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libpthread.a when searching for -lpthread
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libpthread.a when searching for -lpthread
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libpthread.dll.a when searching for -lpthr
ead
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libpthread.a when searching for -lpthread
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lpthread
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libadvapi32.a when searching for -ladvapi3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -ladvapi32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libshell32.a when searching for -lshell32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lshell32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libuser32.a when searching for -luser32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -luser32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libkernel32.a when searching for -lkernel3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel3
2
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lkernel32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libiconv.a when searching for -liconv
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libiconv.a when searching for -liconv
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libiconv.a when searching for -liconv
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -liconv
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmingw32
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lgcc_s
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/\libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1\libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1//libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/libgcc.a when searching for -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lgcc
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldnam
e
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmoldname
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmingwex
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9
.1/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lmsvcrt
collect2.exe: error: ld returned 1 exit status
clang++.exe: error: linker (via gcc) command failed with exit code 1 (use -v to
see invocation)

为什么会这样?我应该总是做所有这些来让 clang 工作吗?

试试这个

Installing Clang 3.5 for Windows.

此致。

目前的方法是...

询问时,默认路径。将它们都放在您的系统路径中(所有用户都可以访问)。如果你要求,Clang 安装程序会把 clang 放在路径中,对于 Mingw,你必须手动完成,我建议 PathEditor2。对于当前版本的 Mingw,要添加到路径中的目录是 C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\bin

然后在调用 Clang 时,使用...

clang -target x86_64-pc-windows-gnu test.c -otest.exe

Clang 将搜索您的路径以找到 Mingw headers 和库,确保您的路径中只有一个版本。

我们尝试 运行 Clang 的测试,如 llvm.org/docs/GettingStartedVS.html 中所述。该过程由于类似的原因而失败,表明未找到 stdio.h。尝试在另一台机器上安装它是成功的。我们 运行 一些详细的 运行s 来识别机器之间的差异,使用“-v”标志对链接过程进行详细描述。

我们发现工作安装在路径变量中默认映射 Windows System32 目录 (C:\Windows\System32)。故障机器没有映射该路径。我们添加了故障机器的路径,一切正常。

这可能是系统管理员出于安全原因实施的更改。如果不允许添加路径,请将“-isystem C:\file\location\here”添加到您希望包含的每个文件的 clang 命令中。