GCC is distributed via git and via
HTTPS as tarballs compressed with gzip
or bzip2
.
Please refer to the releases web page
for information on how to obtain GCC.
The source distribution includes the C, C++, Objective-C, Fortran,
and Ada (in the case of GCC 3.1 and later) compilers, as well as
runtime libraries for C++, Objective-C, and Fortran.
For previous versions these were downloadable as separate components such
as the core GCC distribution, which included the C language front end and
shared components, and language-specific distributions including the
language front end and the language runtime (where appropriate).
If you also intend to build binutils (either to upgrade an existing
installation or for use in place of the corresponding tools of your
OS), unpack the binutils distribution either in the same directory or
a separate one. In the latter case, add symbolic links to any
components of the binutils you intend to build alongside the compiler
(bfd, binutils, gas, gprof, ld,
opcodes, …) to the directory containing the GCC sources.
Likewise the GMP, MPFR and MPC libraries can be automatically built
together with GCC. You may simply run the
contrib/download_prerequisites
script in the GCC source directory
to set up everything.
Otherwise unpack the GMP, MPFR and/or MPC source
distributions in the directory containing the GCC sources and rename
their directories to gmp, mpfr and mpc,
respectively (or use symbolic links with the same name).
Return to the GCC Installation page
Download
GCC releases may be downloaded from our
mirror sites.
Important: these are source releases, so will be of little
use if you do not already have a C++ compiler installed.
As one option, there are
pre-compiled
binaries. for various platforms.
You can also retrieve our sources using Git.
GCC Timeline
The table is sorted by date. Please refer to our
development plan for future
releases and an alternative view of the release history.
Release | Release date |
---|---|
GCC 12.2 | August 19, 2022 |
GCC 10.4 | June 28, 2022 |
GCC 9.5 | May 27, 2022 |
GCC 12.1 | May 6, 2022 |
GCC 11.3 | April 21, 2022 |
GCC 11.2 | July 28, 2021 |
GCC 9.4 | June 1, 2021 |
GCC 8.5 | May 14, 2021 |
GCC 11.1 | April 27, 2021 |
GCC 10.3 | April 8, 2021 |
GCC 10.2 | July 23, 2020 |
GCC 10.1 | May 7, 2020 |
GCC 9.3 | March 12, 2020 |
GCC 8.4 | March 4, 2020 |
GCC 7.5 | November 14, 2019 |
GCC 9.2 | August 12, 2019 |
GCC 9.1 | May 3, 2019 |
GCC 8.3 | February 22, 2019 |
GCC 7.4 | December 6, 2018 |
GCC 6.5 | October 26, 2018 |
GCC 8.2 | July 26, 2018 |
GCC 8.1 | May 2, 2018 |
GCC 7.3 | January 25, 2018 |
GCC 5.5 | October 10, 2017 |
GCC 7.2 | August 14, 2017 |
GCC 6.4 | July 4, 2017 |
GCC 7.1 | May 2, 2017 |
GCC 6.3 | December 21, 2016 |
GCC 6.2 | August 22, 2016 |
GCC 4.9.4 | August 3, 2016 |
GCC 5.4 | June 3, 2016 |
GCC 6.1 | April 27, 2016 |
GCC 5.3 | December 4, 2015 |
GCC 5.2 | July 16, 2015 |
GCC 4.9.3 | June 26, 2015 |
GCC 4.8.5 | June 23, 2015 |
GCC 5.1 | April 22, 2015 |
GCC 4.8.4 | December 19, 2014 |
GCC 4.9.2 | October 30, 2014 |
GCC 4.9.1 | July 16, 2014 |
GCC 4.7.4 | June 12, 2014 |
GCC 4.8.3 | May 22, 2014 |
GCC 4.9.0 | April 22, 2014 |
GCC 4.8.2 | October 16, 2013 |
GCC 4.8.1 | May 31, 2013 |
GCC 4.6.4 | April 12, 2013 |
GCC 4.7.3 | April 11, 2013 |
GCC 4.8.0 | March 22, 2013 |
GCC 4.7.2 | September 20, 2012 |
GCC 4.5.4 | July 2, 2012 |
GCC 4.7.1 | June 14, 2012 |
GCC 4.7.0 | March 22, 2012 |
GCC 4.4.7 | March 13, 2012 |
GCC 4.6.3 | March 1, 2012 |
GCC 4.6.2 | October 26, 2011 |
GCC 4.6.1 | June 27, 2011 |
GCC 4.3.6 | June 27, 2011 |
GCC 4.5.3 | April 28, 2011 |
GCC 4.4.6 | April 16, 2011 |
GCC 4.6.0 | March 25, 2011 |
GCC 4.5.2 | December 16, 2010 |
GCC 4.4.5 | October 1, 2010 |
GCC 4.5.1 | July 31, 2010 |
GCC 4.3.5 | May 22, 2010 |
GCC 4.4.4 | April 29, 2010 |
GCC 4.5.0 | April 14, 2010 |
GCC 4.4.3 | January 21, 2010 |
GCC 4.4.2 | October 15, 2009 |
GCC 4.3.4 | August 4, 2009 |
GCC 4.4.1 | July 22, 2009 |
GCC 4.4.0 | April 21, 2009 |
GCC 4.3.3 | January 24, 2009 |
GCC 4.3.2 | August 27, 2008 |
GCC 4.3.1 | June 6, 2008 |
GCC 4.2.4 | May 19, 2008 |
GCC 4.3.0 | March 5, 2008 |
GCC 4.2.3 | February 1, 2008 |
GCC 4.2.2 | October 7, 2007 |
GCC 4.2.1 | July 18, 2007 |
GCC 4.2.0 | May 13, 2007 |
GCC 4.1.2 | February 13, 2007 |
GCC 4.0.4 | January 31, 2007 |
GCC 4.1.1 | May 24, 2006 |
GCC 4.0.3 | March 10, 2006 |
GCC 3.4.6 | March 06, 2006 |
GCC 4.1.0 | February 28, 2006 |
GCC 3.4.5 | November 30, 2005 |
GCC 4.0.2 | September 28, 2005 |
GCC 4.0.1 | July 7, 2005 |
GCC 3.4.4 | May 18, 2005 |
GCC 3.3.6 | May 3, 2005 |
GCC 4.0.0 | April 20, 2005 |
GCC 3.4.3 | November 4, 2004 |
GCC 3.3.5 | September 30, 2004 |
GCC 3.4.2 | September 6, 2004 |
GCC 3.4.1 | July 1, 2004 |
GCC 3.3.4 | May 31, 2004 |
GCC 3.4.0 | April 18, 2004 |
GCC 3.3.3 | February 14, 2004 |
GCC 3.3.2 | October 17, 2003 |
GCC 3.3.1 | August 8, 2003 |
GCC 3.3 | May 13, 2003 |
GCC 3.2.3 | April 22, 2003 |
GCC 3.2.2 | February 05, 2003 |
GCC 3.2.1 | November 19, 2002 |
GCC 3.2 | August 14, 2002 |
GCC 3.1.1 | July 25, 2002 |
GCC 3.1 | May 15, 2002 |
GCC 3.0.4 | February 20, 2002 |
GCC 3.0.3 | December 20, 2001 |
GCC 3.0.2 | October 25, 2001 |
GCC 3.0.1 | August 20, 2001 |
GCC 3.0 | June 18, 2001 |
GCC 2.95.3 | March 16, 2001 |
GCC 2.95.2 | October 24, 1999 |
GCC 2.95.1 | August 19, 1999 |
GCC 2.95 | July 31, 1999 |
EGCS 1.1.2 | March 15, 1999 |
EGCS 1.1.1 | December 1, 1998 |
EGCS 1.1 | September 3, 1998 |
EGCS 1.0.3 | May 15, 1998 |
EGCS 1.0.2 | March 16, 1998 |
gcc 2.8.1 | March 2, 1998 |
gcc 2.8.0 | January 7, 1998 |
EGCS 1.0.1 | January 6, 1998 |
EGCS 1.0 | December 3, 1997 |
2.7.2.3 | August 22, 1997 |
2.7.2.2 | January 29, 1997 |
2.7.2.1 | June 29, 1996 |
2.7.2 | November 26, 1995 |
2.7.1 | November 12, 1995 |
2.7.0 | June 16, 1995 |
2.6.3 | November 30, 1994 |
2.6.2 | November 12, 1994 |
2.6.1 | November 1, 1994 |
2.6.0 | July 14, 1994 |
2.5.8 | January 24, 1994 |
2.5.7 | December 12, 1993 |
2.5.6 | December 3, 1993 |
2.5.5 | November 27, 1993 |
2.5.4 | November 16, 1993 |
2.5.3 | November 11, 1993 |
2.5.2 | November 1, 1993 |
2.5.1 | October 31, 1993 |
2.5.0 | October 22, 1993 |
2.4.5 | June 20, 1993 |
2.4.4 | June 19, 1993 |
2.4.3 | June 1, 1993 |
2.4.2 | May 31, 1993 |
2.4.1 | May 26, 1993 |
2.4.0 | May 17, 1993 |
2.3.3 | December 26, 1992 |
2.3.2 | November 27, 1992 |
2.3.1 | November 1, 1992 |
2.3 | October 31, 1992 |
2.2.2 | June 14, 1992 |
2.2.1 | June 9, 1992 |
2.2 | June 8, 1992 |
2.1 | March 24, 1992 |
2.0 | February 22, 1992 |
1.42.0 (g++) | September 20, 1992 |
1.42 | September 20, 1992 |
1.41 | August 27, 1992 |
1.41.0 (g++) | July 13, 1992 |
1.40.3 (g++) | October 19, 1991 |
1.40 | June 1, 1991 |
1.39.1 (g++) | May 4, 1991 |
1.39 | January 16, 1991 |
1.38 | December 21, 1990 |
1.37.1 (g++) | March 1, 1990 |
1.37.0 (g++) | February 28, 1990 |
1.37.1 | February 21, 1990 |
1.37 | February 11, 1990 |
1.36.4 (g++) | January 30, 1990 |
1.36.3 (g++) | January 16, 1990 |
1.36 | September 24, 1989 |
1.35 | April 26, 1989 |
1.34 | February 23, 1989 |
1.33 | February 1, 1989 |
1.32 | December 21, 1988 |
1.31 | November 19, 1988 |
1.30 | October 13, 1988 |
1.29 | October 6, 1988 |
1.28 | September 14, 1988 |
1.27 | September 5, 1988 |
1.26 | August 18, 1988 |
1.25 | August 3, 1988 |
1.24 | July 2, 1988 |
1.23 | June 26, 1988 |
1.22 | May 22, 1988 |
1.21 | May 1, 1988 |
1.20 | April 19, 1988 |
1.19 | March 29, 1988 |
1.18 | February 4, 1988 |
1.17 | January 9, 1988 |
1.16 | December 19, 1987 |
1.15.3 (g++) | December 18, 1987 |
1.15 | November 28, 1987 |
1.14 | November 6, 1987 |
1.13 | October 12, 1987 |
1.12 | October 3, 1987 |
1.11 | September 5, 1987 (announced late) |
1.10 | August 22, 1987 |
1.9 | August 18, 1987 (never announced) |
1.8 | August 10, 1987 |
1.7 | July 21, 1987 |
1.6 | July 2, 1987 |
1.5 | June 18, 1987 |
1.4 | June 13, 1987 |
1.3 | June 10, 1987 |
1.2 | June 1, 1987 |
1.1 | May 24, 1987 |
1.0 | May 23, 1987 |
0.9 (first beta release) | March 22, 1987 |
Home
Name | Modified | Size | InfoDownloads / Week |
---|---|---|---|
MinGW | 2013-10-26 |
1,045,294 |
|
Installer | 2013-10-04 |
1,508,713 |
|
Other | 2011-11-13 |
2,093 |
|
MSYS | 2011-11-13 |
1,195,197 |
|
README | 2011-11-13 | 896 Bytes |
40 |
Totals: 5 Items | 896 Bytes | 3,751,337 |
Welcome to the MinGW project file distribution directories. This is the top level directory containing Installer, MinGW, MSYS and Other directories. You will find Base, Extension and Contribution directories that are futher broken down by package in the MinGW and MSYS directories. You will find mingw-get and mingw-get-inst in the Installer directory. The Other directory contain a hodgepodge of files and packages that have either been contributed or maintained once upon a time but may or may not still be useful. If you have a package you wish to see distributed by MinGW and are willing to commit to contributing it per direction from MinGW maintainers then please ask on the mingw-users@lists.sourceforge.net list. You will need to use the mgwport application to package your package per the MinGW specifications and you will need to create the XML files for the mingw-get meta data.
Source: README, updated 2011-11-13
Для того, чтобы писать программы на C/C++ обычно достаточно установить какую-нибудь интерактивную среду разработки (IDE), например, Visual Studio или Eclipse, однако иногда (обычно в целях обучения студентов) требуется создавать программы в обыкновенном текстовом редакторе и компилировать приложение, используя консоль и компилятор gcc. В Unix системах он обычно установлен прямо «из коробки», а вот на Windows системах такой роскоши не наблюдается. Более того, у многих пользователей возникает множество проблем при установке компилятора. Поэтому нами было принято решение написать данную статью, чтобы помочь всем тем, кому пришлось или приходится мучаться с установкой этого компилятора на Windows.
Кстати, если вдруг на вашей Unix системе не установлен GCC, то поставить его можно командой sudo apt install gcc
, введя свой пароль и согласившись на установку.
0. Прежде чем поставить компилятор GCC
Перед тем как приступить к установке этого компилятора на ваш компьютер, убедитесь в том, что GCC ещё не установлен на нём. Для этого откройте консоль (нажмите Win + R, введите в появившемся окне cmd и нажмите клавишу Enter) и введите следующую команду: gcc --version
и нажмите Enter. Если компилятор уже установлен, то выполненная команда выдаст примерно следующую информацию:
gcc (GCC) 8.1.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Если в окне консоли появилось сообщение с версией компилятора и другая информация о GCC (второй скриншот), значит компилятор уже установлен и больше дополнительно ничего делать не нужно. А вот если вывод командной строки такой:
"gcc" не является внутренней или внешней командой, исполняемой программой или пакетным файлом
— значит GCC ещё не установлен в системе, поэтому двигаемся дальше.
Появившееся окно консоли
GCC уже установлен
GCC не установлен
1. Скачиваем установщик компилятора
Чтобы поставить GCC на операционную систему Windows, необходимо скачать установочный файл для него. Сделать это можно здесь: equation.com/servlet/equation.cmd?fa=fortran. Найдите в таблице версию компилятора, которая вам больше нравится (мы рекомендуем скачивать самую последнюю, на текущий момент — это версия 8.2.0) и скачайте установщик для вашей системы (32 или 64 бит).
Выбор установочного файла
2. Установка GCC
После того, как файл был скачан, откройте в проводнике папку, в которую был скачан установщик и запустите его, кликнув по файлу дважды левой кнопкой мыши. Появится окно, требующее подтверждения действия. В нём нужно выбрать да (иначе ничего ставиться не будет).
Установщик начнёт работу и отобразит окно с консолью, а также окно с бежевым фоном, в котором попросит прочесть и принять (или отклонить) лицензионное соглашение. Нажимаем Accept.
Открывшееся окно с установщиком
Принимаем лицензионное соглашение
После этого установщик попросит выбрать путь для установки, предложив по умолчанию путь C:mingw
. Если вам категорически не нравится этот путь — измените его на более подходящий на ваш взгляд, в противном же случае просто нажмите Install.
Выбор папки для установки
Теперь остаётся только дождаться окончания распаковки архивов и установки их на компьютер. Как только все файлы будут установлены, инсталятор сообщит об этом, после чего нужно будет нажать на кнопку Finish.
Распаковка файлов и установка
Окончание установки
3. Проверка установки
По завершении работы установщика перезагрузите компьютер и вновь откройте окно командной строки, введите команду gcc --version
и нажмите Enter. На этот раз ответ от этой команды должен будет совпадать со вторым скриншотом из пункта 0. Если это не так, то скорее всего работа установщика была некорректно или преждевременно завершена, так что просто начните установку заново.
GCC установлен
Поздравляем! Теперь на вашем компьютере установлен компилятор GCC и вы можете писать программы на языках C и C++, а компилировать их через командную строку!
4. Бонус. Компиляция программ с помощью GCC
Теперь, когда у вас установлен компилятор GCC, вы можете создавать программы на C/C++, используя только текстовый редактор и консоль. Для этого создайте новый файл и назовите его как угодно (например, hello_world). Задайте ему расширение .c
вместо .txt
. Напишите (или скопируйте) текст программы на С в этот файл. Откройте командную строку (Win + R, cmd) и введите следующую команду gcc hello_world.c
и нажмите Enter. Если код не содержит ошибок, то результатом команды будет пустота. В противном же случае вы увидите все ошибки, который нашёл компилятор в программе с указанием места этой ошибки. При этом в проводнике появится файл a.out.exe
, который будет являться исполняемым файлом для написанной программы. Чтобы запустить его введите в консоли a.out
(для Unix-систем нужно писать ./a.out
) и нажмите Enter.
Что ещё за a.out? Непонятно!
По умолчанию при компиляции программ GCC в качестве результата создаём исполняемый файл с именем a.out (если такой уже есть, то b.out и т.д.). Это может быть не очень удобно, если у вас в папке лежит сразу много программ, которые нужно скомпилировать и затем запустить. Неудобно хотя бы тем, что разобраться, что такое a.out, а что такое b.out и c.out может быть непросто. Именно поэтому мы рекомендуем компилировать программы с явным указанием имени выходного файла. делается это так: gcc имя_файла.c -o имя_программы
.
В результате выполнения такой программы вместо a.out будет создаваться файл с именем, заданным в имя_программы. Например, если для файла hello_world.c мы хотим получить программу hello, то компилировать нужно такой командой: gcc hello_world.c -o hello
.
Результат компиляции и запуска программы
Используя понятные имена выходных программ (исполняемых файлов), вы гарантируете себе простоту работы и сокращение времени на разбирательство спустя долгое время.
Возможно, также будет интересно: как установить Sublime Text для работы с C/C++.
Программист, сооснователь programforyou.ru, в постоянном поиске новых задач и алгоритмов
Языки программирования: Python, C, C++, Pascal, C#, Javascript
Выпускник МГУ им. М.В. Ломоносова
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.
In this tutorial, we will learn how to install GCC in Windows 10, Mac, and Linux.
We will use an open-source Integrated Development environment named Code::Blocks which bundles a compiler (named gcc offered by Free Software Foundation GNU), editor and debugger in a neat package.
Step 1) Download Binary release
Go to http://www.codeblocks.org/downloads and click Binary Release.
Step 2) Select the installer with GCC for Windows compiler
Choose the installer with GCC Compiler, e.g., codeblocks-17.12mingw-setup.exe which includes MinGW’s GNU GCC compiler download and GNU GDB debugger with Code::Blocks source files.
Step 3) Start installation
Run the downloaded installer and accept the default options to install GCC Windows file.
Step 4) Accept the terms and conditions
Accept the Agreement
Step 5) Keep default component selection
Keep the component selection default and click Next.
Step 6) Locate the installation path
You may change the installation folder and click Next.
Step 7) Find and double-click on the CodeBlocks icon
To launch Code::Blocks double click on the icon.
Step Let it detect the compiler itself
It will detect the GCC compiler for Windows automatically, set it as default.
Associate C/C++ files with code::blocks
Step 9) Open the IDE and start using
You will see the IDE Home screen.
Install GCC Linux
Linux operating systems mostly comes with GCC preinstalled. To verify if the compiler is installed on the machine, run the following command in the terminal:
gcc --version
After executing this command if the gcc is installed on the machine then it will return the information about the compiler otherwise it will ask you to install the compiler.
To set up the ‘C’ environment on Linux distributions follow the given steps:
1. Open terminal.
2. For red-hat, Fedora users, type and execute this command
# yum groupinstall 'Development Tools'
3. For Debian and Ubuntu users, type and execute following command
$ sudo apt-get update $ sudo apt-get install build-essential manpages-dev
4. To verify that the GCC has been successfully installed on the machine as we discussed earlier, execute the following command
gcc --version
Install GCC on Mac
To set up a ‘C’ programming environment on MAC operating system, follow the given steps:
1. Visit the given link https://developer.apple.com/downloads/index.action and download. You will need an Apple developer ID
“Command Line Tools for X-Code,” pick any version (latest version is always recommended) and download the .dmg file.
2. After the file is being downloaded on the machine, double click and follow the wizard and install the file. Always keep the default settings as suggested by the installation wizard.
3. After the installation process, open a terminal and run gcc -v command to check if everything is successfully installed.
Conclusion:
‘C‘ program can be written and executed on any machine that has a suitable environment to run the program. Its recommended using an IDE or C compiler for Windows to run C programs. An IDE includes a compiler, editor and debugger. Clanfg, MinGW compiler (Minimalist GNU compiler collection for Windows), Portable ‘C’ compiler, Turbo C are popular compilers available.
The heart of the Mingw-w64 project is headers and support libraries to
run the output of GCC on Windows. Since Mingw-w64 is neither the home of
GCC nor of binutils, several sets of installation packages which combine
them are available.
In addition, the sources are available but most people will want to grab
binaries directly..
Version | Host | GCC / Mingw-w64 Version | Languages | Additional Software in Package Manager | |
---|---|---|---|---|---|
Arch Linux |
Arch Linux | 12.2.0/10.0.0 | Ada, C, C++, Fortran, Obj-C, Obj-C++ | many | |
Cygwin |
Rolling | Windows | 11.3.0/10.0.0 | C, C++, Fortran, Obj-C | many |
Debian |
Debian 9 (Stretch) | 6.3.0/5.0.1 | Ada, C, C++, Fortran, Obj-C, Obj-C++, OCaml | 9 (gdb, libassuan, libgcrypt, libgpg-error, libksba, libnpth, nsis, win-iconv, zlib) | |
Debian 10 (Buster) | 8.3.0/6.0.0 | Ada, C, C++, Fortran, Obj-C, Obj-C++ | |||
Debian 11 (Bullseye) | 10.2.1/8.0.0 | ||||
Fedora |
Fedora 36 | 11.2.1/9.0.0 | Ada, C, C++, Fortran, Obj-C, Obj-C++ | many | |
Fedora 37 | 12.2.1/10.0.0 | ||||
LLVM-MinGW | 20220906 | Windows, Linux | LLVM 15.0.0/trunk | C, C++ | make, Python |
w64devkit | 1.17.0 | Windows | 12.2.0/10.0.0 | C, C++, Fortran |
7 (busybox, cppcheck, ctags, gdb, make, nasm, vim) |
MacPorts |
Rolling | macOS | 12.2.0/10.0.0 | C, C++, Fortran, Obj-C, Obj-C++ | 1 (nsis) |
MingW-W64-builds | Rolling | Windows | 12.2.0/10.0.0 | C, C++, Fortran | 4 (gdb, libiconf, python, zlib) |
MSYS2 |
Rolling | Windows | 12.2.0/trunk | Ada, C, C++, Fortran, Obj-C, Obj-C++, OCaml | many |
WinLibs.com | Rolling | Windows | 12.2.0 | Ada, C, C++, Fortran, Obj-C, Obj-C++, Assembler | Package manager: work in progress (will offer > 2500 packages) |
Ubuntu |
18.04 Bionic Beaver | 7.3.0/5.0.3 | Ada, C, C++, Fortran, Obj-C, Obj-C++ | 9 (gdb, libassuan, libgcrypt, libgpg-error, libksba, libnpth, nsis, win-iconv, zlib) | |
20.04 Focal Fossa | 9.3.0/7.0.0 | ||||
22.04 Jammy Jellyfish | 10.3.0/8.0.0 | ||||
22.10 Kinetic Kudu | 10.3.0/10.0.0 | ||||
Arch Linux
Installation:
- Community repository (toolchain)
- AUR repository (additional packages)
Ubuntu
Installation: through integrated package manager.
Mingw-w64 packages on Ubuntu
Cygwin
Cygwin is a Unix-like environment and command-line
interface for Microsoft Windows. Its core is the cygwin1.dll library which
provides POSIX functionality on top of the Win32 API. It can be used as a build
environment which targets Windows directly and for which output doesn’t depend
on cygwin1.dll.
Installation is done through cygwin’s package manager:
setup.exe.
As part of the numerous packages in cygwin, there are cross-compilation
toolchains which target both 32 bits and 64 bits; their names start with
“mingw64-”.
Once they are installed, they should be used according to the general
cross-compilation approach.
Debian
Installation: through integrated package manager.
Mingw-w64 packages on Debian
Fedora
Installation: through integrated package manager.
LLVM-MinGW
LLVM-MinGW is a toolchain built with Clang, LLD, libc++, targeting
i686, x86_64, arm and aarch64 (ARM64), with releases both for running
as a cross compiler from Linux and for running on Windows. It supports
Address Sanitizer, Undefined Behaviour Sanitizer, and generating debug
info in PDB format.
Installation: GitHub
w64devkit
w64devkit is a portable C and C++ development kit for x64 (and x86) Windows.
Included tools:
- Mingw-w64 GCC : compilers, linker, assembler
- GDB : debugger
- GNU Make : standard build tool
- busybox-w32 : standard unix utilities, including sh
- Vim : powerful text editor
- Universal Ctags : source navigation
- NASM : x86 assembler
- Cppcheck : static code analysis
The toolchain includes pthreads, C++11 threads, and OpenMP. All included
runtime components are static.
Installation: GitHub
MacPorts
To install just the 32-bit or just 64-bit compiler with dependencies, use:
sudo port install i686-w64-mingw32-gcc
sudo port install x86_64-w64-mingw32-gcc
A shortcut to install both:
sudo port install mingw-w64
Here is the list of Mingw-w64 packages on MacPorts.
Mingw-builds
Installation: GitHub
WinLibs.com
Standalone MinGW-w64+GCC builds for Windows, built from scratch (including all depencencies) natively on Windows for Windows.
Downloads are archive files (.zip
or .7z
). No installation is required,
just extract the archive and start using the programs in mingw32bin
or mingw64bin
.
This allows for a relocatable compiler suite and allows having multiple versions on the same system.
Also contains other tools including:
* GDB — the GNU Project debugger
* GNU Binutils — a collection of binary tools
* GNU Make — a tool which controls the generation of executables and other non-source files
* Yasm — The Yasm Modular Assembler Project
* NASM — The Netwide Assembler
* JWasm — A free MASM-compatible assembler
Flavors:
* separate packages for 32-bit (i686) and 64-bit (x86_64) Windows
* separate packages for MSVCRT and UCRT builds
* only POSIX threads builds (which also include Win32 API thread functions)
* exception model: Dwarf for 32-bit (i686) and SEH for 64-bit (x86_64)
Installation: Download from winlibs.com and extract archive (no installation needed).
MSYS2
Installation: GitHub
Sources
Tarballs for the mingw-w64 sources are hosted on
SourceForge.
The latest version from the 10.x series is 10.0.0.
The latest version from the 9.x series is 9.0.0.
The latest version from the 8.x series is 8.0.2.
The latest version from the 7.x series is 7.0.0.
The latest version from the 6.x series is 6.0.0.
The latest version from the 5.x series is 5.0.4.
The old wiki has instructions for building
native
and
cross
toolchains.
Details on how to get the mingw-w64 code from Git and an Git-web viewer are
available on
SourceForge.
Unsorted complementary list
Darwin/Mac OS X
The existing Darwin binaries have been built through buildbot in 2013 and links
to them can be found on the dedicated
page.
OpenSUSE
The OpenSUSE Linux
distribution also has a
large and well-maintained set of packages for cross-compilation.
Rubenvb
Rubenvb has built a number of toolchains including some for less common setups.
They are split into two categories: toolchains targeting
Win32
or
Win64.
GCC with the MCF thread model
GCC with the MCF thread model is a series of x86
and x64 native toolchains built by LH_Mouse. The MCF thread model involves the
mcfgthread library to provide minimum
yet complete C++11 thread support. Disregarding POSIX or Windows XP
compatibility, it implements (hopefully the most) efficient mutexes and
condition variables that are competitive with even native slim reader/write
(SRW) locks and condition variables since Windows Vista.
Store of binaries on SourceForge
A very large number of other binaries and sources are hosted in the File
Release System on Sourceforge which
might have what you are after.
The easiest way to get TDM-GCC is via an installer.
Download a TDM-GCC installer: | |
---|---|
tdm-gcc-webdl.exe |
Minimal online installer. Select the components you want, and it downloads and unpacks them. Either edition, latest release only. (GCC 10.3.0) |
tdm64-gcc-10.3.0-2.exe |
64+32-bit MinGW-w64 edition. Includes GCC C/C++, GNU binutils, mingw32-make, GDB (64-bit), the MinGW-w64 runtime libraries and tools, and the windows-default-manifest package. |
tdm-gcc-10.3.0.exe |
32-bit-only MinGW.org edition. Includes GCC C/C++, GNU binutils, mingw32-make, GDB (32-bit), the MinGW.org mingwrt and w32api packages, and the windows-default-manifest package. |
The following links are for TDM-GCC releases since the TDM-GCC 9 series. Older
versions are still available on SourceForge:
TDM-GCC files.
TDM Distributed Package | Binaries | Sources |
---|---|---|
GCC, TDM32 or TDM64 | Github:jmeubank/tdm-gcc-src/releases | Github:jmeubank/tdm-gcc-src/tree/tdm-patches.public |
GCC, MinGW.org | OSDN:mingw/releases/p15691 | OSDN:mingw/releases/p15691 |
GNU binutils (TDM64) | Github:jmeubank/tdm-binutils-gdb/releases | Github:jmeubank/tdm-binutils-gdb/tree/tdm-patches-binutils.public |
GNU binutils (MinGW.org) | OSDN:mingw/releases/p15608 | OSDN:mingw/releases/p15608 |
GDB (TDM32, TDM64) | Github:jmeubank/tdm-binutils-gdb/releases | Github:jmeubank/tdm-binutils-gdb/tree/tdm-patches-gdb.public |
GDB (MinGW.org) | SourceForge:mingw/files/MinGW/Extension/gdb/ | SourceForge:mingw/files/MinGW/Extension/gdb/ |
MinGW-w64 runtime libraries and tools (TDM64) | Github:jmeubank/mingw-w64/releases | Github:jmeubank/mingw-w64/tree/tdm-patches |
MinGW.org runtime and w32api libraries | OSDN:mingw/releases/p15587 | OSDN:mingw/releases/p15587 |
Windows default manifest (TDM32, TDM64) | Github:jmeubank/windows-default-manifest/releases | Sourceware.org:git/cygwin-apps/windows-default-manifest |
mingw32-make | SourceForge:mingw/files/MinGW/Extension/make | SourceForge:mingw/files/MinGW/Extension/make |
GCC, abbreviation for ‘GNU Compiler Collection’ (thanks @saphirakai
) (and not Gulf Cooperation Council, like I’d assumed) is a necessity if you (or your pesky college) is into C Programming.
Almost all Linux distros come pre-installed with it so they are out of the trouble. But for those of you who were constant users of Windows and Command Prompt, and never felt the necessity for a C compiler, GCC seems to come out of the blue and a tough nut to install. 1000 rage-quits later, I present you this article.
This article is written so that the installation process is made easier than most of the trashy articles I had to go through.
Installation
-
Go to MinGW official website and click on ‘Downloads’ on the left panel. You’ll be redirected to the site which hosts the files.
Important Edit: MinGW official website is now down (as of 24th March 2021). Hence, instead of their official website, download from MinGW SourceForge page - Look for mingw-get-setup.exe for downloading. Download it and launch the installer. Accept the terms and move on.
- You’ll now see that the installer is connecting to the Internet and downloading a lot of tiny and small files. Wait till it ends.
- Right when it ends (which won’t take long), you’ll be presented a window with title MinGW Installation Manager. You should be in the ‘Basic Setup’ tab by default when it launches. If not, click on Basic Setup.
- Out of the numerous check boxes presented to you on the right side, tick «mingw32-gcc-g++-bin«. If you are prompted with a menu, click on Mark for Install.
- Then on the top left corner click on Installation > Apply Changes. And wait while it downloads a billion files and installs them.
- Now you gotta edit your «Environment Variables» as well, so that gcc works in cmd no matter the file location.
- For that go to Windows Explorer > Right click on This PC > Properties > Advanced system settings > Environment Variables or you could just search for «Environment Variables» in Windows Search…
-
At the bottom «System Variables» panel, look for a Variable named «Path» and double click on it. Some systems show a good UI for adding a New Path easily (by clicking New), else you just need to add ; at the end and add the following path
C:MinGWbin
(This is assuming you didn’t manually change any installation paths and went with just clicking ‘Next’ during installation)
-
Click on OK, and OK and close the other windows. Open a Command Prompt Terminal and try typing
gcc --version
and press Enter.If you get something like
gcc (MinGW.org GCC Build-2) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gcc has been successfully installed in your PC. Enjoy!
Cheers and happy coding!