您不应该添加C:\MinGw\libexec\gcc\mingw32\4.7.2
到路径中。
添加:c:\MinGW\bin
您可能需要重新启动以确保该路径对所有进程都可用。
另一个建议是使用不同的 MinGW 发行版。自从我使用“官方”MinGW 发行版以来已经有很长时间了,因为安装步骤是如此的拜占庭式和脆弱的。我听说他们在安装程序方面取得了很大进步,但据我所知,它似乎仍然相当复杂和脆弱。
TDM 的安装程序可以正常工作,但我认为 TDM 版本还不是 4.7.2。
nuwen发行版的安装只是将档案解压到你想要的地方(我喜欢那个!)并确保路径指向 gcc.exe 的位置。Nuwen 还打包了 boost 库,这很好。
我认为它会有所帮助,这就是我从中得到的gcc -v hello.c
(c:\mingw.4.7.2\bin
在路径中):
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/cc1.exe -quiet -v -iprefix c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/ hello.c -quiet -dumpbase hello.c -mtune=generic -march=i686 -auxbase hello -version -o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include"
ignoring nonexistent directory "c:/temp/gcc/dest/include"
ignoring nonexistent directory "/c/temp/gcc/dest/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed"
ignoring nonexistent directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../include
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed
End of search list.
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8461a53e6fc78ff58191bda61fe9586d
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
as -v -o C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU assembler version 2.22 (i686-pc-mingw32) using BFD version (GNU Binutils) 2.22
COMPILER_PATH=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../libexec/gcc/
LIBRARY_PATH=c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../lib/gcc/;c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/collect2.exe -Bdynamic c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../crt2.o c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtbegin.o -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2 -Lc:/mingw.4.7.2/bin/../lib/gcc -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../.. C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtend.o