How to install GCC on Windows 7

GCC for Windows is provided by two projects currently. They both provide a very own implementation of the Windows SDK (headers and libraries) which is necessary because GCC does not work with Visual Studio files.

  1. The older mingw.org, which @Mat already pointed you to. They provide only a 32-bit compiler, and the latest version is GCC 4.5 as of the time of this writing. See here for the downloads you need:

    • Binutils is the linker and resource compiler etc.
    • GCC is the compiler, and is split in core and language packages
    • GDB is the debugger.
    • runtime library is required only for mingw.org
    • You might need to download mingw32-make seperately.
    • For support, you can try (don't expect friendly replies) [email protected]
  2. The newer mingw-w64, which as the name predicts, also provides a 64-bit variant. It is superior in every way to #1 above. You can install with an installer, or find the toolchain files for 32-bit and 64-bit yourself. Alternatively, you can use MSYS2 which provides a huge amount of prebuilt binary packages installable through a package manager, pacman. Note that the MSYS2 toolchains work outside of the MSYS shell just fine; using it as a package manager only is possible. A third option is to use Qt's MinGW packages, which come bundled with a toolchain. For support, send an email to [email protected] or the forum via sourceforge.net.

There are a lot of "non-official" toolchain builders, one of the most popular is TDM-GCC. They may use patches that break binary compatibility with official/unpatched toolchains, so be careful using them. It's best to use the official releases (or in the case of mingw-w64, the Personal builds are easier to get started with).

Re the other answer: Cygwin/MSYS != GCC. Using GCC does not require the other. Plain users shouldn't be compiling GCC. That process is waaay to involved and time-consuming. Enough binary distributions floating around...


You don't install GCC like this. You use "Cygwin" or "MSYS" for this purpose (compiling). Cygwin is like a.... Linux-Windows combination? One should read the documentation. In a nutshell: You get a Bash, GCC and other stuff, but it is SLOW.

MSYS is much better on the other hand. It provides a win32 binary of GCC and all the development tools.

If you just want to develop, you should choose a package like this: http://www.codeblocks.org/downloads/26 codeblocks-10.05mingw-setup.exe << This one.


GCC is available through Chocolatey:

choco install mingw -y

Restart the command prompt and you should be able to run gcc.

Tags:

Gcc

Windows 7