EDIT Since not so recently by now, MinGW-w64 has "absorbed" one of the toolchain building projects. The downloads can be found here. The installer should work, and allow you to pick a version that you need.
Note the Qt SDK comes with the same toolchain. So if you are developing in Qt and using the SDK, just use the toolchain it comes with.
Another alternative that has up to date toolchains comes from... harhar... a Microsoft developer, none other than STL (Stephan T. Lavavej, isn't that a spot-on name for the maintainer of MSVC++ Standard Library!). You can find it here. It includes Boost.
Another option which is highly useful if you care for prebuilt dependencies is MSYS2, which provides a Unix shell (a Cygwin fork modified to work better with Windows pathnames and such), also provides a GCC. It usually lags a bit behind, but that is compensated for by its good package management system and stability. They also provide a functional Clang with libc++ if you care for such thing.
I leave the below for reference, but I strongly suggest against using MinGW.org, due to limitations detailed below. TDM-GCC (the MinGW-w64 version) provides some hacks that you may find useful in your specific situation, although I recommend using vanilla GCC at all times for maximum compatibility.
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.
The older mingw.org, which @Mat already pointed you to. They provide only a 32-bit compiler. 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]
Alternatively, download mingw-get and use that.
The newer mingw-w64, which as the name predicts, also provides a 64-bit variant, and in the future hopefully some ARM support. I use it and built toolchains with their CRT. Personal and auto builds are found under "Toolchains targetting Win32/64" here. They also provide Linux to Windows cross-compilers. I suggest you try a personal build first, they are more complete. Try mine (rubenvb) for GCC 4.6 to 4.8, or use sezero's for GCC 4.4 and 4.5. Both of us provide 32-bit and 64-bit native toolchains. These packages include everything listed above. I currently recommend the "MinGW-Builds" builds, as these are currently sanctioned as "official builds", and come with an installer (see above).
For support, send an email to [email protected] or post on the forum via sourceforge.net.
Both projects have their files listed on sourceforge, and all you have to do is either run the installer (in case of mingw.org) or download a suitable zipped package and extract it (in the case of mingw-w64).
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.
Answer from rubenvb on Stack OverflowEDIT Since not so recently by now, MinGW-w64 has "absorbed" one of the toolchain building projects. The downloads can be found here. The installer should work, and allow you to pick a version that you need.
Note the Qt SDK comes with the same toolchain. So if you are developing in Qt and using the SDK, just use the toolchain it comes with.
Another alternative that has up to date toolchains comes from... harhar... a Microsoft developer, none other than STL (Stephan T. Lavavej, isn't that a spot-on name for the maintainer of MSVC++ Standard Library!). You can find it here. It includes Boost.
Another option which is highly useful if you care for prebuilt dependencies is MSYS2, which provides a Unix shell (a Cygwin fork modified to work better with Windows pathnames and such), also provides a GCC. It usually lags a bit behind, but that is compensated for by its good package management system and stability. They also provide a functional Clang with libc++ if you care for such thing.
I leave the below for reference, but I strongly suggest against using MinGW.org, due to limitations detailed below. TDM-GCC (the MinGW-w64 version) provides some hacks that you may find useful in your specific situation, although I recommend using vanilla GCC at all times for maximum compatibility.
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.
The older mingw.org, which @Mat already pointed you to. They provide only a 32-bit compiler. 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]
Alternatively, download mingw-get and use that.
The newer mingw-w64, which as the name predicts, also provides a 64-bit variant, and in the future hopefully some ARM support. I use it and built toolchains with their CRT. Personal and auto builds are found under "Toolchains targetting Win32/64" here. They also provide Linux to Windows cross-compilers. I suggest you try a personal build first, they are more complete. Try mine (rubenvb) for GCC 4.6 to 4.8, or use sezero's for GCC 4.4 and 4.5. Both of us provide 32-bit and 64-bit native toolchains. These packages include everything listed above. I currently recommend the "MinGW-Builds" builds, as these are currently sanctioned as "official builds", and come with an installer (see above).
For support, send an email to [email protected] or post on the forum via sourceforge.net.
Both projects have their files listed on sourceforge, and all you have to do is either run the installer (in case of mingw.org) or download a suitable zipped package and extract it (in the case of mingw-w64).
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.
Download mingw-get and simply issue:
mingw-get install gcc.
See the Getting Started page.
How do I get a GCC?
.net - How to install GCC for Go on Windows 10? - Stack Overflow
How to install GCC / MinGW on Windows ? (QT 5.1.1)? confused ! | Qt Forum
Why is installation so complicated?
Videos
I recently started learning and then I realized I needed a GCC so my C code can run but I am having a lot of problems trying to download it
USE MINGW-W64
Install mingw-w64 (Follow the "Sourceforge" link) and install it to the default
Program Filesbased path.Select the latest "version" (for GCC), change "architecture" from
i686(32-bit) tox86_64(64-bit), and change "threads" towin32.Add the
binfolder to the beginning of your Git BASH (MINGW64) path:$ export PATH="c:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin:$PATH"You'll, of course, need to adjust the above path to match the version of your of your particular install:
$ export PATH="c:/Program Files/mingw-w64/<YOUR_ARCH_VERSION_REVISION_FOLDER>/mingw64/bin:$PATH"
Alternatively
You may be able to just install it directly into the same folder as Git:
C:\Program Files\Git.
But I haven't tried this alternative approach and I wouldn't recommend it because it is likely to cause issues when updating and may confuse uninstallers, leaving remnants. (if the two installations don't interfere to begin with)
[ Edit: GNU Make is installed as mingw32-make.exe. You can make a copy of it, somewhere in your $PATH which you have permission to, and rename it to make. Git Bash seems to respect that it's executable, even without an extension, which is handy if you don't want it picked up outside of the MinGW environment (even though it may be in your PATH). ]
You have to share Windows' PATH (and probably other) environment variables with MinGW. For MSYS2 you can share them by adding this to your Windows' env. variables:
MSYS2_PATH_TYPE=inherit