3

I don't quite understand the difference between the following C/C++ compilers: GCC, MinGW, Cygwin and MSVC. Are the MinGW and Cygwin implementations of GCC or something entirely different? If I intend to compile for Windows, do I ever need anything other than the MSVC (Visual Studio) compiler?

1
  • 1
    cygwin is not a compiler, it's a set of libraries that create a Linux-like environment inside Windows, and common linux tools compiled with those libraries. There's a port of gcc to cygwin. Commented Dec 29, 2013 at 3:29

1 Answer 1

1

GCC for Windows is mostly useful for makefiles and code written with gcc-specific non-portable syntax.

cygwin is not a compiler, it's a set of libraries that create a Linux-like environment inside Windows, and common linux tools compiled with those libraries.. It is useful for code written with Unixisms (expect files to behave a certain way, or assume the directory separator is /, or assume Linux paths).

If you have pure Windows code, you'll be happiest with Visual C++ (MSVC). Or, if that doesn't optimize well enough, the Intel C++ compiler.

Visual C++ also works well for portable ISO-conformant code... but Microsoft is a little behind the curve on implmenting C++11 and C++14 features. So that's another reason you might want to use gcc (or clang).

Sign up to request clarification or add additional context in comments.

7 Comments

Intel has a lot of compiler suites so I'm going to have to familiarise myself with each one. So Intel compilers are good for AMD and all architectures such as 32/64?
I just noticed now that they're not free nor open source.
@user1338113: No, the Intel compilers are not free. They're for professional programmers who need the best performance money can buy. And the code they generate will run on AMD also, but performance is tuned for Intel processors.
-mwindows and -mno-windows don't specify Cygwin/without-Cygwin. Those options specify that the produced program is a Windows GUI or Windows Console program respectively. If you're targeting the Cygwin platform, then you need a gcc compiler that targets Cygwin. If you're targeting a native Win32 platform program then you need a gcc compiler that targets mingw32 (ie., Win32). Different runtimes are used. Cygwin GCC compilers used to be able to target native Win32, but a long time ago that support was dropped as being a waste of effort.
@MichaelBurr: Oh, I see the option I meant was -mno-cygwin, and it's since been discontinued. Are you sure the capability is completely gone? I would imagine that it remains possible using a cross-compiler (using the same cross-compile logic used to build mingw-runtime apps on Linux).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.