7

I want to install a GCC compiler in Windows for the Eclipse IDE. I know there are two options: MinGW GCC or Cygwin GCC. Which one is better for Eclipse CDT? Any experience or suggestions will be appreciated.

tonga
  • 10,669
  • 23
  • 69
  • 93
  • Use whatever you like. I would recommend to go for MinGW, this way you will avoid annoying cygwin1.dll dependency. – Andrejs Cainikovs Nov 21 '12 at 23:10
  • possible duplicate of [What is the difference between Cygwin and MinGW?](http://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw) – Cole Johnson Jan 30 '14 at 02:04

5 Answers5

10

Using Cygwin means your program will be dependent on cygwin1.dll, which is essentially a layer that allows POSIX functionality to be used in a Windows environment. Compiling with the standard MinGW GCC provides no such dependancy. This means however, if you intend to compile with MinGW GCC, you will not have access to POSIX functions such as fork() and exec().

For more information on the differences between Cygwin and MinGW, see here.

Community
  • 1
  • 1
wardd
  • 562
  • 3
  • 8
  • I tried installing MinGW and it works fine except it does not support POSIX functions such as fork(). However, it does support POSIX thread such as pthread. So why it supports POSIX pthread but not fork()? I found that from in /mingw/include directory, there is no fork() declaration in this header file. – tonga Nov 22 '12 at 16:36
  • 2
    It supports pthread because there exists a Windows implementation of it. There just happen to be Windows implementations of some POSIX functions, such as sockets and pipes. Some implementations (such as sockets) are almost identical to their POSIX counterparts, but others are completely different (like pipes). MinGW is just a port of GCC, it does not attempt to emulate POSIX functions for Windows, because Windows is not a POSIX compliant system. That's where Cygwin comes in. You can think of Cygwin as a port that provides an implementation of POSIX functions in Windows. – wardd Nov 23 '12 at 00:04
  • 1
    wardd, thanks a lot for explaining in great details. This is very helpful in understanding the diff between MinGW and Cygwin regarding POSIX compatibility. – tonga Nov 23 '12 at 16:39
2

Personally I like Cygwin better, it has a lot of installation options and it feels a lot like the terminal you'll find on a Linux machine. It provides a pretty substantial set of Linux-like capabilities, something that Windows fails at miserably.

amn
  • 6,917
  • 6
  • 48
  • 75
earl3s
  • 2,195
  • 1
  • 20
  • 23
2

My offhand thoughts are, if you need cygwin, you need it. For instance compiling programs that were developed for Unix and have symbolic links and shell scripts in the build system.

If you don't need it, you don't want it. And compiling under linux on a virtual machine is often a better choice than going the cygwin route.

So mingw is perfectly fine. Works fine, simple to use.

Also: You might consider codelite (www.codelite.org) instead of Eclipse.

Gibbon1
  • 21
  • 1
1

Cygwin and Mingw are not interchangeable alternatives. Cygwin is used to compile POSIX API programs, Mingw is used compile Windows API programs.

Chose one or the other depending on what kind program you're going to write.

chill
  • 15,637
  • 2
  • 35
  • 43
1

Wikipedia Says:

MinGW forked from version 1.3.3 of Cygwin. Although both Cygwin and MinGW can be used to port UNIX software to Windows, they have different approaches: Cygwin aims to provide a complete POSIX layer that provides emulations of several system calls and libraries that exist on Linux, UNIX, and the BSD variants. The POSIX layer runs on top of Windows, sacrificing performance where necessary for compatibility. Accordingly, this approach requires Windows programs written with Cygwin to run on top of a copylefted compatibility library that must be distributed with the program, along with the program's source code. MinGW aims to provide native functionality and performance via direct Windows API calls. Unlike Cygwin, MinGW does not require a compatibility layer DLL and thus programs do not need to be distributed with source code.

Because MinGW is dependent upon Windows API calls, it cannot provide a full POSIX API; it is unable to compile some UNIX applications that can be compiled with Cygwin. Specifically, this applies to applications that require POSIX functionality like fork(), mmap() or ioctl() and those that expect to be run in a POSIX environment. Applications written using a cross-platform library that has itself been ported to MinGW, such as SDL, wxWidgets, Qt, or GTK+, will usually compile as easily in MinGW as they would in Cygwin.

The combination of MinGW and MSYS provides a small, self-contained environment that can be loaded onto removable media without leaving entries in the registry or files on the computer. Cygwin Portable provides a similar feature. By providing more functionality, Cygwin becomes more complicated to install and maintain.

It is also possible to cross-compile Windows applications with MinGW-GCC under POSIX systems. This means that developers do not need a Windows installation with MSYS to compile software that will run on Windows without Cygwin.

PersianGulf
  • 2,388
  • 4
  • 36
  • 60