Both MinGW and Cygwin have solved the problem of cross-compilation of C + + cross-platform, making it possible for Linux programs to compile and run on Windows.
MinGW provides a similar set of tools on Windows for people who are accustomed to developing on Linux, and Cygwin is primarily for Linux programs that can be ported to Windows without the need to change the code, GNUWIN32 primarily to people who are accustomed to Linux tools , a similar set of commands is available on Windows .
C code compiled under UNIX is not possible under Win32, and of course Unix and Win32 APIs conform to standard C, that is, most function calls are identical under UNIX and Win32. But UNIX has its own unique API (such as Fork,spawn, Signals,select,sockets, etc.), if these APIs are used in the code, the corresponding libraries are not found under Win32. But the functionality of these APIs can also be implemented in Win32, which provides two ways to let Windows compile Unix-style code:
- Modify the compiler so that the compiler under window translates calls such as fork into an equivalent form, which is MinGW's approach
- Modify the Library so that window provides a Unix-like library that interfaces to programs like UNIX, and these libraries are implemented by the Win32 API, which is Cygwin's approach
MinGW
MinGW, a contraction of "minimalist GNU for Windows", was a minimalist development environment for native Microsoft Windows applications.
MinGW provides a complete Open Source programming tool Set which are suitable for the development of native ms-windows APPL Ications, and which do not depend on any 3rd-party c-runtime DLLs.
MinGW provides a set of Linux-like tools for developers who are accustomed to developing Linux on Windows, which includes a range of software: compilation tools, link tools, dump tools, debugging tools, and other development tools. MinGW also provides some open source base support libraries, such as the GNU C/C + + RT library (libc, libstdc++), POSIX's basic invocation interface (including pthread), and even the invocation interface for OpenGL and Windows APIs. Almost all of the software in MinGW is ported to Windows under the GNU project or Linux.
Unlike GNU,MinGW builds the executable (. exe) or library (. dll,.lib) file under Windows, but the intermediate files in the compilation process are still. o files, not. obj files.
The POSIX interface of the MINGW is far less comprehensive than the Cygwin implementation (such as: Even Bsd/linux sockets are not available, only with Winsock), so MinGW is just a toolset for developing Windows-only apps .
Later MinGW had a subproject called: MSYS, which included more Linux tools with a target similar to Cygwin: building a Linux simulation environment under Windows.
MSYS, a contraction of "Minimal system", is a Bourne Shell command line interpreter SYStem. Offered as an alternative to Microsoft's Cmd.exe, this provides a general purpose command line environment, which is parti Cularly suited to use with MinGW, for porting of many Open Source applications to the Ms-windows platform; A light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.
Note: MinGW official website: http://www.mingw.org/
Cygwin
Cygwin is:
- A large collection of GNU and Open Source tools which provide functionality similar to a Linux Distributionon Windows.
- A DLL (cygwin1.dll) which provides substantial POSIX API functionality.
Cygwin names are derived from the GNU, Cygnus, and windows abbreviations. The goal of Cygwin is to build a Linux simulation environment under Windows. As a result, Cygwin is a huge project that includes not only the development environment under Linux, but also the work environment and various Linux software.
In the early days, the core of Cygwin was cygwin1.dll, which could be considered a POSIX interface implementation, relying on this dynamic link library, unix/linux under the software can be easily ported to Windows, and the style remains unchanged. However, with the development of Cygwin, more and more unix/linux procedures, the establishment of Cygwin-based complex programs rely on more and more libraries, now loaded with the default configuration of Cygwin, you will find a lot of cyg beginning of the dynamic link library.
Note:
Cygwin official website: http://www.cygwin.com/
Cygwin Chinese web: http://www.cygwin.cn/
GnuWin32
GNUWIN32 enables Windows users to use a variety of Linux commands in a command-line window, as simple as using a normal Windows command.
Note: GnuWin32 official website: http://gnuwin32.sourceforge.net/
MinGW & Cygwin