9

I have been programming for a while at an intermediate level of course. I have been executing the same code in these different compilers (mostly GCC and MinGW), but I'm unable to make out the difference between these compilers. I mean by what way is the one better than the other? Or what makes them different? Are there some special needs where you might want to use GCC and for others maybe MinGW?

Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185
Rahul
  • 9,553
  • 17
  • 53
  • 76
  • 1
    The main thing about the Borland compiler is that it doesn't belong to Borland (or whatever they're named this year) anymore. They sold it to Embarcadero. – sbi Nov 02 '10 at 14:42
  • 1
    well i am more keen on the technical differences , than their names . Well they must have some pros and cons which the other one may overcome – Rahul Nov 02 '10 at 14:45
  • http://stackoverflow.com/questions/771756/what-is-the-difference-between-cygwin-and-mingw – Flexo Feb 10 '12 at 10:57

4 Answers4

6

MinGW and GCC are really the same compiler underneath. MinGW is a GCC port for the Windows platform.

The reasons why you would use different compilers (as in, based on different front-ends) are:

  • You have a binary-only library that is guaranteed to play nice only if you use particular compilers and those happen to be different compilers for different platforms
  • You need to target multiple platforms, and there is no compiler that targets all your platforms
  • You have legacy code that uses particular compiler extensions on different platforms.
Bart van Ingen Schenau
  • 14,464
  • 4
  • 29
  • 40
  • so mean to say , i is if have a compiled binary file fetched from one compiler , it may not run if i tried to execute it through another compiler ? – Rahul Nov 02 '10 at 14:54
  • 1
    @Rahul: Once you have an executable, you don't need the compiler anymore to execute it. If you have a library built with compiler A then it can not be used with compiler B, unless both compilers target the same platform and one of them has documented that it is supported. – Bart van Ingen Schenau Nov 02 '10 at 15:08
5

When in doubt, use gcc. It is a venerable, old and well tested compiler that's free and used a lot, particulary in Linux space. minGW is a port of some GNU development utilities for Windows, including gcc.

I haven't used Borland's compiler. Ideally, your programs compiled with it should run exactly like when they're compiled using gcc.

Gcc and Borland basically do the same thing. Simplified, they take source code files as input and spit out executables as output. Their internal implementation is vastly different, but that shouldn't be your concern.

Differences that should matter to you are their command line flags and error/warning messages when something goes wrong.

darioo
  • 43,550
  • 10
  • 71
  • 102
0

One HUGE difference is that Borland focuses on Windows system only (at least when I was using it) and as such it has a lot of really nice custom Windows specific commands and libraries. GCC is sooo much more generic that it can take lot more work to do the same things that Borland can do w/o much fuss.

0

Borland is the compiler used in turbo c++. it works differently compared to GCC/MinGW. The header files must include

#include<iostream.h>
#include<conio.h>

and

using namespace std;

is not used in Borland like GCC.

In GCC, we began with

#include<iostream>
using namespace std;

in Borland, the namespace is automatically chosen and also you need to include the input-output conditions like #include<conio.h>.