clang/clang++ doesn't find C/C++ headers in wi

2019-01-25 05:55发布

问题:

1 hour ago I downloaded llvm-3.6.0-rc4-win32.exe from http://llvm.org/pre-releases/3.6.0/ .

I tried to compile simple C code that just print "hello" , but it didn't compile , because clang.exe can't find stdio.h. when I use clang-cl.exe with the same code , it worked .

I also have the same problem with clang++ even with iostream , I add -I flag to GCC (4.9.1) C++ headers , the result:

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.

Anyone know how to fix this ?

Edit : I found bits/c++config.h in MinGW folders I add it to the -I flag and other .

I result a link error :

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)

why all of this ? should I always make all this to make clang works.

回答1:

Try this one

Installing Clang 3.5 for Windows.

Regards.



回答2:

The current method to do it is...

  • Install mingw-w64-install.exe (currently 7.2.0, make sure to set "i686" to "x86_64" when asked)
  • Install Clang for Windows (64-bit) (currently 5.0.0)

When asked, default paths. Place them both in your system path (accessible for all users). The Clang installer will put clang in the path if you ask it to, for Mingw, you have to do it manually, I recommend PathEditor2. For the current version of Mingw, the directory to add to your path is C:\Program Files\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev0\mingw64\bin

Then when invoking Clang, use...

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

Clang will search your path to find the Mingw headers and libraries, make sure you only have one version in your path.