from: http://blog.sina.com.cn/s/blog_492abb0f0100fwnu.html
MinGW - Minimalist GNU for Windows
MinGW - A collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs.
mingw 是windows版本的gnu c/c++工具集 主要包括编译器gcc,连接器make,调试器gdb
MinGW 官方网站为 http://www.mingw.org
可参考最新版本,为如下地址:
http://sourceforge.net/projects/mingw/
安装软件:
1,mingwrt-3.15.1,通过网络安装,将所有的东西都装在C:\MinGW(默认目录),但是最好改成c:\mingw 这样可以同msys更好的结合
下载地址:http://sourceforge.net/projects/mingw/
2,Visual-MinGW 0.59,安装完毕后,Visual-MinGW会提示让你寻找compile目录,这时候选mingw安装目录(默认是C:\MinGW)即可
下载地址:http://visual-mingw.sourceforge.net/
3,mingw32-make-3.80.0-3.exe
下载地址:http://sourceforge.net/project/downloading.php?groupname=mingw& filename=mingw32-make-3.80.0-3.exe&use_mirror=nchc
4,配置环境变量,复制“mingw32-make.exe”增加“make.exe”
5,打开Visual-MinGW,想写点啥就写点啥吧,finish
提示:
(1)MinGW-4.1.1.exe安装时(这里只是安装”current”,不安装”source”)下载以下几个包:
ada.tar.gz
binutils.tar.gz
g++.tar.gz
g77.tar.gz
gcc.tar.gz
java.tar.gz
runtime.tar.gz
w32api.tar.gz
objc.tar.gz
mingw32-make.tar.gz
如果你水平可以,完全可以单独下几个自己需要的包配置一下,而不需要安装在(1)里如上配置
(2)配置环境变量:
PATH C:\mingw\bin;%PATH% (千万别直接覆盖PATH变量,务必将其放在最前面,要用分号隔开)
LIBRARY_PATH C:\mingw\lib
C_INCLUDEDE_PATH C:\mingw\include
INCLUDE C:\mingw\include
CPLUS_INCLUDE_PATH C:\mingw\include\c++\3.4.5;C:\mingw\include\c++\3.4.5\mingw32;C:\mingw\include\c++\3.4.5\backward;C:\mingw\include
(不同版本的c++版本不同,不要盲目照转,如安装不同的MinGW版本, 清注意配置)
(3) 将C:\mingw\bin下的文件“mingw32-make.exe”复制一份并改名为“make.exe”,方便以后操作。
测试:
(1)在cmd中执行下make命令(如c:\mingw\bin>make.exe),如果出现“***No targets specfied and no make file found stop”,设置成功。
(2)在cmd中输入“gcc -v”,如果屏幕出现“gcc不是内部命令或外部命令,也不是可运行的程序或批处理文件。”表示环境变量设定有问题。
如果出现如下显示,表示设定成功。
H:\>gcc -v
Reading specs from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32
--target=mingw32 --prefix=/mingw --enable-threads -le-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroni
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)
H:\>
(3)在cmd中输入“mingw32-make -version”或者是"make -v",如果屏幕出现:
H:\>mingw32-make -version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i686-pc-mingw32
H:\>make -v
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i686-pc-msys
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Report bugs to <bug-make@gnu.org>.
转载于:https://blog.51cto.com/tianya23/932729