Msys/mingw and cygwin/GCC)

Source: Internet
Author: User

I. mingw

Mingw official website for http://www.mingw.org/

Mingw, that is, minimalist GNU for Windows (GCC compiler suite ). It is a collection of header files and port libraries that allow people to use GCC (GNU Compiler C) to generate windows32 programs without a third-party dynamic link library.

 

Mingw: a Windows-specific header file that can be freely used and released, and a collection of imported and exported using the GNU tool set. At the basic layer, mingw is a set of files and port libraries, its function is to allow console-mode programs to use Microsoft's Standard C Runtime Library (msvcrt. DLL). This library is valid on all nt OS, and is valid on all Windows OS Versions later than Windows 95, you can use the GCC write Console mode to conform to the American Organization for Standardization (ANSI) program, and use the C Runtime extension provided by Microsoft. This function is not available for Windows 32 APIs. The next component is the w32api package, which is a group of files and port libraries that can use windows32 APIs. When combined with basic runtime, You can have full rights to use both CRT (C Runtime) and windows32 API functions.

 

In fact, mingw is not only a C/C ++ compiler, but also a set of GNU tools. Apart from GCC (GNU Compiler set), mingw also contains some other gnu program development tools (such as gawk bison ).

 

Mingw is developed to provide a GNU working environment for those who do not like to work in the Linux (FreeBSD) operating system and stay in windows. Therefore, with mingw, we can use the GNU program development tool as in Linux.

 

GCC is the core of mingw. GCC is a compilation system that supports many computer programming languages, and is the closest to the standard in terms of implementation of language standards. In addition, GCC can be transplanted to almost all currently available computer platforms.

 

GCC itself does not have the IDE interface as VC does (but many open-source ides support mingw, such as codeblocks and eclipse ). You can select any text editor you like to edit the source code (it is said that Microsoft developers, including VC, do not use the IDE editor provided by VC, but choose the GNU Vim editor ). Then, use make and other tools to compile, Link, package, and publish software projects. Source code version control tools like CVS (SVN) allow anyone in any corner of the world to participate in software projects.

 

For the MFC and Microsoft basic library classes, this open source code development kit with VC ++ is the same as other Windows Development kits. If you have VC ++ authorization, you can use the source code of MFC, that is, you can use GCC to compile the MFC program.

 

Of course, there are many windows Development kits under GNU, and some of them support cross-platform use. You can not only directly compile the source code into a Windows program, but also compile it into a graphical program of other operating systems without modification.

 

Ii. msys

Official Website for http://www.mingw.org/

Msys: Unix-like command line utilities, including basic bash, make, gawk and grep. It can also be considered as a small UNIX on Windows. Mingw can be used to simulate a Unix environment on Windows.

 

Msys-CN: http://code.google.com/p/msys-cn/

Msys released in China and used Unix development environment to develop Windows programs.

 

Msys simulates a Unix-like terminal in Windows. It only provides the mingw user loading environment and uses mingw in the Unix environment simulated by msys, just like using GCC in UNIX.

 

Iii. cygwin/GCC

Cygwin/GCC and mingw are both GCC compiling environments in windows, but what are their differences? In actual work, how can we choose these two compilers.

 

Cygwin/GCC can be equivalent to GCC in Linux. This can be seen from the division of the boost library, GCC in cygwin and GCC in Linux use the same toolsets. Therefore, you can synchronize the GCC version with Linux without worrying about the problem. What cygwin/GCC does (Win32 is not needed) can be seamlessly used in Linux without any problems. Is a good choice for Developing Linux programs in windows.

 

However, the program compiled in cygwin/GCC must depend on cygwin1.dll in windows, and the execution speed is slow, -MnO-cygwin must be added to the GCC compilation options. When this option is added, the GCC compiler automatically selects the mingw installed when cygwin/GCC is installed. This mingw is a cross-Compilation of GCC.

 

For mingw as an implementation of GCC on Windows, because it does not run on a simulated Linux like cygwin GCC, and a considerable number of Linux tools cannot be used, however, msys, a Unix shell, can solve many problems.

 

Iv. Summary

Mingw is a collection of Windows GCC versions and does not need to depend on the intermediate layer.

Msys is a simulation of a small Linux environment. It can be combined with mingw to simulate the use of mingw GCC in a Linux environment.

Cygwin is a powerful Linux environment, because cygwin1.dll converts underlying windows APIs to Linux APIs. Therefore, development in cygwin is equivalent to development in Linux. for developers, it is equivalent to calling Linux-type APIs. Therefore, such programs can be directly transplanted to Linux. However, if such a program is to be executed on Windows, cygwin1.dll must be supported during running.

 

Based on the above analysis, if you develop a cross-platform Linux program in windows, the cygwin Linux simulator and the GCC contained are good choices, but the developed program must depend on a cygwin1.dll. If you only want to use the GCC compiler in windows and do not want to rely on other DLL, mingw is a good choice.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.