我最近在运行Windows 7的机器上安装了LLVM和Clang。它还安装了cygwin。我转到this URL并按照第1部分和第2部分中的说明进行操作。我为32位和64位安装了MinGW。但是,我没有目录C:\mingw64
,我没有目录C:\mingw32
。我有一个名为C:\mingw
的目录,而我的目录是mingw32
。
我在页面上保存了两个.bat
文件setgcc32
和setgcc64
并运行了它们。当我在32位模式下尝试以下命令行时:
clang++ main.cpp -o main.exe -std=c++14
我明白了:
c:\Rtools\gcc-4.6.3\bin\ld.exe: cannot find -lgcc_s
c:\Rtools\gcc-4.6.3\bin\ld.exe: cannot find -lgcc_s
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
当我在64位模式下尝试时,我得到:
main.cpp:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
我做错了什么?
当我运行此命令时:
clang++ -v main.cpp -o main.exe -std=c++14
在32位模式下,我得到:
clang version 3.7.0 (tags/RELEASE_370/rc3)
Target: i686-pc-windows-gnu
Thread model: posix
"C:\\Program Files (x86)\\LLVM\\bin\\clang++.exe" -cc1 -triple i686-pc-windows-
gnu -emit-obj -mrelax-all -disable-free -main-file-name main.cpp -mrelocation-mo
del static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mc
onstructor-aliases -target-cpu pentium4 -v -dwarf-column-info -resource-dir "C:\
\Program Files (x86)\\LLVM\\bin\\..\\lib\\clang\\3.7.0" -internal-isystem "c:\\R
tools\\gcc-4.6.3\\i686-w64-mingw32\\include\\c++" -internal-isystem "c:\\Rtools\
\gcc-4.6.3\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32" -internal-isystem
"c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\include\\c++\\backward" -internal-isys
tem "c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\include\\c++\\4.6.3" -internal-isy
stem "c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\include\\c++\\4.6.3\\i686-w64-min
gw32" -internal-isystem "c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\include\\c++\\
4.6.3\\backward" -internal-isystem "c:\\Rtools\\gcc-4.6.3\\include\\c++\\4.6.3"
-internal-isystem "c:\\Rtools\\gcc-4.6.3\\include\\c++\\4.6.3\\i686-w64-mingw32"
-internal-isystem "c:\\Rtools\\gcc-4.6.3\\include\\c++\\4.6.3\\backward" -inter
nal-isystem "c:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i686-w64-mingw32\\4.6.3\\include\\
c++" -internal-isystem "c:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i686-w64-mingw32\\4.6.3
\\include\\c++\\i686-w64-mingw32" -internal-isystem "c:\\Rtools\\gcc-4.6.3\\lib\
\gcc\\i686-w64-mingw32\\4.6.3\\include\\c++\\backward" -internal-isystem "C:\\Pr
ogram Files (x86)\\LLVM\\bin\\..\\lib\\clang\\3.7.0\\include" -internal-isystem
"c:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i686-w64-mingw32\\4.6.3\\include" -internal-is
ystem "c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32/sys-root/mingw/include" -internal
-isystem "c:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i686-w64-mingw32\\4.6.3\\include-fixe
d" -internal-isystem "c:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\include" -interna
l-isystem "c:\\Rtools\\gcc-4.6.3\\include" -std=c++14 -fdeprecated-macro -fdebug
-compilation-dir "C:\\tmp6" -ferror-limit 19 -fmessage-length 80 -mstackrealign
-fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnosti
cs-show-option -fcolor-diagnostics -o "C:\\Users\\Bob\\AppData\\Local\\Temp\\mai
n-fdf675.o" -x c++ main.cpp
clang -cc1 version 3.7.0 based upon LLVM 3.7.0-rc3 default target i686-pc-window
s-gnu
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
\i686-w64-mingw32"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
\backward"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
\4.6.3"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
\4.6.3\i686-w64-mingw32"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include\c++
\4.6.3\backward"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\lib\gcc\i686-w64-mingw32\4.6
.3\include\c++"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\lib\gcc\i686-w64-mingw32\4.6
.3\include\c++\i686-w64-mingw32"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\lib\gcc\i686-w64-mingw32\4.6
.3\include\c++\backward"
ignoring nonexistent directory "c:\Rtools\gcc-4.6.3\i686-w64-mingw32/sys-root/mi
ngw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\Rtools\gcc-4.6.3\include\c++\4.6.3
c:\Rtools\gcc-4.6.3\include\c++\4.6.3\i686-w64-mingw32
c:\Rtools\gcc-4.6.3\include\c++\4.6.3\backward
C:\Program Files (x86)\LLVM\bin\..\lib\clang\3.7.0\include
c:\Rtools\gcc-4.6.3\lib\gcc\i686-w64-mingw32\4.6.3\include
c:\Rtools\gcc-4.6.3\lib\gcc\i686-w64-mingw32\4.6.3\include-fixed
c:\Rtools\gcc-4.6.3\i686-w64-mingw32\include
c:\Rtools\gcc-4.6.3\include
End of search list.
"c:\\Rtools\\gcc-4.6.3\\bin\\ld.exe" -m i386pe -Bdynamic -o main.exe "c:\\Rtool
s\\gcc-4.6.3\\i686-w64-mingw32\\lib\\crt2.o" "c:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i
686-w64-mingw32\\4.6.3\\crtbegin.o" "-Lc:\\Rtools\\gcc-4.6.3\\lib\\gcc\\i686-w64
-mingw32\\4.6.3" "-Lc:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32\\lib" "-Lc:\\Rtools\
\gcc-4.6.3\\lib" "-Lc:\\Rtools\\gcc-4.6.3\\i686-w64-mingw32/sys-root/mingw/lib"
"C:\\Users\\Bob\\AppData\\Local\\Temp\\main-fdf675.o" -lstdc++ -lmingw32 -lgcc_s
-lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -l
mingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt "c:\\Rtools\\gcc-4.6.3\\lib\
\gcc\\i686-w64-mingw32\\4.6.3\\crtend.o"
c:\Rtools\gcc-4.6.3\bin\ld.exe: cannot find -lgcc_s
c:\Rtools\gcc-4.6.3\bin\ld.exe: cannot find -lgcc_s
clang++.exe: error: linker command failed with exit code 1 (use -v to see invoca
tion)