跨平台编译环境-MinGw
2010-12-22 16:08:11 阿炯

MinGW(Minimalist GNU for Windows),又称Mingw32,是一套以 Gnu gcc/egcs 计划为基础的编译器,其可编译出在 Win32 系统上执行的 ojbect code。是将GNU开发工具移植到Win32平台下的产物,包括一系列头文件(Win32API)、库和可执行文件。MinGW是从Cygwin(1.3.3版)基础上发展而来,但是用MinGW开发的程序不需要额外的第三方DLL支持就可以直接在Windows下运行,而且也不一定必须遵从GPL许可证。

MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

MinGW provides a complete Open Source programming tool set which is suitable for the development of native MS-Windows applications, and which do not depend on any 3rd-party C-Runtime DLLs. (It does depend on a number of DLLs provided by Microsoft themselves, as components of the operating system; most notable among these is MSVCRT.DLL, the Microsoft C runtime library. Additionally, threaded applications must ship with a freely distributable thread support DLL, provided as part of MinGW itself).

MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.

"Mingw32" 是取 Minimalist Gnu-Win32 计划之意,其目标为提供一个可在 Win32 平台上,开发 Win32 native code 的编译器,而非提供 unix 程式移植到 Win32 平台之用,此即为其 minimalist 之意。

Mingw32 使用 Microsoft runtime libraries ,因此由其产生之程式,执行时不需先行安装其他的 DLL 。 此外,其提供 Win32 API 的 header ,故可在程式中呼叫 Win32 API ,并相当程度地相容於 MS Visual C++ binary ,可以使用 VC++ 的 libraries ,也支援部份的 COM 。

理论上, Mingw32 可使用 Win32 系统上的各式 Software Develope Toolkit ,例如 DirectX 便已经证实可行。

Mingw32 提供两种 Microsoft runtime libraries 版本,一是 Ctrdll.dll ,另一为 Msvcrt.dll 。Ctrdll.dll 存在於所有的 Win32 系统上,甚至在 Windows 3.11/Windows NT 3.5 等 Win32s 系统上亦有,但是很久没有更新了。

Msvcrt.dll 则为较新且持续进行更新与增添功能的 runtime library ,其存在於较新的 Win32 系统上,简单的分辨方式为,如果该电脑上有安装 IE4 或以上的版本时,便有 Msvcrt.dll 。Mingw32 主要以 Ctrdll.dll 为测试目标,故采用 Ctrdll.dll 的版本较稳定。

GCC 就是 MinGW 的核心所在,GCC 是一套支持众多计算机程序语言的编译系统,而且在语言标准的实现上是最接近于标准的。并且 GCC 几乎可以移植到目前所有可用的计算机平台。(我的电脑上就还装有 DevKitPro,里面包含 GCC 的 ARM(for GBA/DS/GP32) 和 MIPS(for PSP) 版本。)

GCC 本身不像 VC 那样拥有IDE 界面(在 Windows 上也存在 Dev C++ 之类的支持 MinGW 编译器的 IDE)。源代码编辑你可以选用任何你喜欢的文本编辑器(据说微软的开发人员包括 VC 的开发都不用 VC 所带的 IDE 编辑器,而是选用 GNU 的 VIM 编辑器)。然后使用 make 等工具来进行软件项目的编译、链接、打包乃至发布。而像 cvs(svn) 源代码版本控制工具可以让世界上任何一个角落的人都可以参与到软件项目中来。

最新版本:2.1


官方主页:http://www.mingw.org/