通过查看gcc -v信息整理出下面的表格(虽然版本号不一致,但编译选项应该差不多的)
官方版 | TDM版 |
---|
Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --disable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T Thread model: win32 gcc version 4.8.1 (GCC) | Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=../libexec/gcc/mingw32/4.7.1/lto-wrapper.exe Target: mingw32 Configured with: ../../src/gcc-4.7.1/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-build-poststage1-with-cxx --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections-fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs Thread model: win32 gcc version 4.7.1 (tdm-1) |
以前没有搞明白为什么从网上看到有的minGW编译时需要加上"-static-libgcc -static-libstdc++"两个选项,现在明白了,那是因为使用了官方minGW编译器的缘故,如果用TDM版就不需要了!
CodeBlocks自带的就是TDM-minGW。