- WinLibs standalone build of GCC and MinGW-w64 for Windows
- What is it?
- Who is it for?
- Download
- Release versions
- Snapshot versions
- Other downloads
- Goals
- Usage
- From the Windows Command Prompt
- From Code::Blocks
- Known issues
- License
- Who are you?
- Support winlibs.com
- Как установить компилятор gcc / g++ для Windows. Установка gcc
- 0. Прежде чем поставить компилятор GCC
- 1. Скачиваем установщик компилятора
- 2. Установка GCC
- 3. Проверка установки
- 4. Бонус. Компиляция программ с помощью GCC
- Что ещё за a.out? Непонятно!
- А Вы знаете, что мы пишем программы на C, C++, C#, Pascal и Python?
- Почему именно мы?
- Как с нами связаться?
WinLibs standalone build of GCC and MinGW-w64 for Windows
What is it?
In short: it’s a free C and C++ compiler for Microsoft Windows.
GCC (GNU Compiler Collection) is a free and open source compiler for C and C++ (and other languages like Objective-C, Fortran, D).
MinGW-w64 is a free and open source C library for targetting Windows 32-bit and 64-bit platforms.
The combination of these results in a free C/C++ compiler for Windows.
Even though GCC and MinGW-w64 can be used on other platforms (e.g. Linux) to generate Windows executables, the WinLibs project only focusses on building versions that run natively on Windows.
Also some additional tools are added, 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
- LLVM/Clang/LLD/LLDB — The LLVM Compiler Infrastructure
This is a standalone build, which means this download offers a complete compiler environment for Windows.
In the future WinLibs plans to also release binary packages of many open source libraries and applications built with this compiler.
Click here to see the philosophy and design decisions behind winlibs.com.
Who is it for?
Download
The following downloads are available (for Windows only).
*You will need a decompressor like 7-Zip (free) to unzip .7z archives, but they are a lot smaller than .zip files.
Each version comes in 2 flavors:
- Win32 — i686 — Windows 32-bit version, runs natively on and compiles for Windows 32-bit (also runs on Windows 64-bit, but in 32-bit mode)
- Win64 — x86_64 — Windows 64-bit version, runs natively on and compiles for Windows 64-bit (will not run on Windows 32-bit)
Release versions
- GCC 10.3.0 + LLVM/Clang/LLD/LLDB 11.1.0 + MinGW-w64 8.0.0 — release 1 (LATEST)
- Win32: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- Win64: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- GCC 10.2.0 + LLVM/Clang/LLD/LLDB 11.0.0 + MinGW-w64 8.0.0 — release 8
- Win32: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- Win64: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- GCC 10.2.0 + LLVM/Clang/LLD/LLDB 10.0.1 + MinGW-w64 7.0.0 — release 4
- Win32: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- Win64: 7-Zip archive* | Zip archive — without LLVM/Clang/LLD/LLDB: 7-Zip archive* | Zip archive
- GCC 9.3.0 + LLVM/Clang/LLD/LLDB 10.0.0 + MinGW-w64 7.0.0 — release 4
- Win32: 7-Zip archive*
- Win64: 7-Zip archive*
- GCC 8.4.0 + MinGW-w64 7.0.0 — release 1
- Win32: 7-Zip archive*
- Win64: 7-Zip archive*
- GCC 7.5.0 + MinGW-w64 7.0.0 — release 1
- Win32: 7-Zip archive*
- Win64: 7-Zip archive*
Snapshot versions
In between release versions of GCC occasional snapshots are made available. As these are not actual releases they should not be treated as such.
Snapshots versions may be useful to test the latest features or check for bugs when building with the latest versions.
- GCC 11.0.1 snapshot 20210228 (experimental) + MinGW-w64 8.0.0 — release 1
- Win64: 7-Zip archive*
- GCC 10.2.1 snapshot 20210227 (experimental) + MinGW-w64 8.0.0 — release 1
- Win32: 7-Zip archive*
- Win64: 7-Zip archive*
- GCC 9.3.1 snapshot 20200703 (experimental) + MinGW-w64 7.0.0
- Win32: 7-Zip archive* | Zip archive
- Win64: 7-Zip archive* | Zip archive
Other downloads
For checksum files and older releases check out the GitHub releases page.
GCC already runs on many different platforms (including GNU/Linux and Apple macOS) and had been around for a long time (since 1987).
C — and derived languages like C++ and Objective-C — are the preferred programming languages for a lot of software, including many open source projects, and even for operating systems themselves.
Having a GCC compiler on Windows allows making Windows versions of many software projects that already exist for other operating systems (e.g. GNU/Linux).
This allows application developers to build native binaries of their software for multiple operating systems including Windows.
But also, when starting software projects from scratch, it opens up the possibility to use many existing (open source) libraries and better future portability to other platforms (if the developer(s) avoid calling native Windows functions).
Goals
Each release build is built with itself or a newer release, so optimizations included in newer GCC versions are also compiled into the compiler itself.
The ultimate goal of WinLibs is to also provide libraries built with this compiler, in order to provide a comprehensive C/C++ development environment, with the following goals in mind:
- provide both static and shared libraries where possible
- focus on production quality (no debug versions of libraries and debugging information stripped from binaries)
- useability from the MSYS2 shell aswell as from IDEs like Code::Blocks
- no installation or registry requirements and disk location independant
Usage
From the Windows Command Prompt
Compiling from the console isn’t generally the most easy way of building software, but this explanation shows how you can get started quickly.
Open the Windows Command Prompt.
Make sure the mingw32/bin or mingw64/bin folder from the extracted download is in your PATH and its location doesn’t contain any spaces.
Go to the directory where your source files are (C:\Temp in the example below).
SET PATH=D:\Prog\winlibs64-9.2.0-7.0.0\mingw64\bin;%PATH% CD /D C:\TEMP
Create your source file(s) (helloworld.c in the example below).
In Notepad create the new file and then save it:
#include int main ()
Compile the example:
gcc -o helloworld.exe helloworld.c
Or if you want to compile and link in seperate steps:
gcc -c -o helloworld.o helloworld.c gcc -o helloworld.exe helloworld.o
Then you can run the compiled program:
From Code::Blocks
Code::Blocks is a free integrated development environment (IDE) for C and C++.
- Open Code::Blocks
- Configure debugger
- In the top menu go to Settings and select Debugger.
- In the left pane select GDB/CDB debugger
- Click Create Config and enter a name (e.g. Debug_MINGW32 for 32-bit (i686) or Debug_MINGW64 for 64-bit (x86_64))
- Select this new entry on the left
- Set the location of bin\gdb.exe under the mingw32 or mingw64 folder from the extracted download (you can also browse to it by clicking on the . button)
- Leave the other settings to their defaults (including Debugger type = GDB ) and press OK
- Configure compiler
- In the top menu go to Settings and select Compiler.
- Under Selected compiler choose GNU GCC Compiler
- Click Copy and enter a name (e.g. MINGW32 for 32-bit (i686) or MINGW64 for 64-bit (x86_64))
- Under Selected compiler choose this new entry (should be at the bottom of the list)
- Click the tab Toolchain executables
- Under Compiler’s installation directory set the location of the mingw32 or mingw64 folder from the extracted download (you can also browse to it by clicking on the . button)
- Click the tab Program Files set the following settings (taking into account 32-bit (i686) or for 64-bit (x86_64))
- C compiler : i686-w64-mingw32-gcc.exe / x86_64-w64-mingw32-gcc.exe
- C++ compiler : i686-w64-mingw32-g++.exe / x86_64-w64-mingw32-g++.exe
- Linker for dynamic libs : i686-w64-mingw32-g++.exe / x86_64-w64-mingw32-g++.exe
- Linker for static libs : i686-w64-mingw32-gcc-ar.exe / x86_64-w64-mingw32-gcc-ar.exe
- Debugger : Debug_MINGW32 / Debug_MINGW64 (as created earlier)
- Resource compiler : windres.exe
- Make program : mingw32-make.exe
- Create new project
- Go to File / New / Project.
- Select project template you need (like Console application ) and click Go
- Step through the wizard which will ask serveral questions, including of your project is in C or C++, the name of your project and where to save it
- On the last page under Compiler select the compiler you wish to use (e.g. MINGW32 for 32-bit (i686) or MINGW64 for 64-bit (x86_64)) and click Finish
- An example main.c file will be created automatically, which you can modify as needed
- Press the F9 key to compile, link and run the application
Known issues
Problem: In some cases (e.g. when building GCC 10.2.0) there are printf format compiler errors when building against MinGW-w64 8.0.0. See MinGW-w64 ticket #853.
Solution: No general soluton yet. To fix building GCC 10.2.0 replace #include with # undef HAVE_INTTYPES_H in libgomp/target.c and libgomp/oacc-parallel.c .
Problem: When building software that sets _FORTIFY_SOURCE to something other than 0 there are errors when building against MinGW-w64 7.0.0. See MinGW-w64 ticket #818.
Solution: Add linker flag -lssp somewhere after the source or object files.
For example for most projects using autoconf tools just add LIBS=»-Wl,—as-needed -lssp» at the end of the ./configure line.
Release 2 was built with configure flag —enable-default-ssp to resolve this.
Problem: When using GCC 10 there are multiple definition of ` ‘ linker errors that weren’t there when using earlier versions of GCC.
Solution: Add compiler flag -fcommon . See this link for more information.
License
Please see each of the components and dependancies for their respective licenses.
Here are the licenses of the most important components:
- GCC: GPL
- MinGW-w64: Zope Public License (ZPL) with exceptions
- GDB: GPL
- GNU Binutils: GPL
- GNU Make: GPL
- Yasm: 2-clause BSD license
- NASM: 2-clause BSD license
- JWasm: Sybase Open Watcom Public License version 1.0
- LLVM/Clang/LLD/LLDB: Apache License
Who are you?
My name is Brecht Sanders, and I have been a passionate open source user and developer for many years.
Around 2006 I discovered MinGW (and later MinGW-w64) as a great way to build libraries and applications with GCC on Windows.
This has the following advantages:
- programming in C and/or C++ for native Windows without the need to install any development software from Microsoft or other commercial companies
- possibility to compile many of the open source packages the Linux/Unix world has to offer for native Windows, especially when used in combination with MSYS2
- write portable cross platform software in C and/or C++ using the same compiler and build tools as on the other platforms (like Linux and macOS)
Support winlibs.com
If you like this project and would like to support it please consider donating.
Как установить компилятор gcc / g++ для Windows. Установка gcc
15 декабря 2018
Время чтения: 5 минут
Для того, чтобы писать программы на 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 ещё не установлен в системе, поэтому двигаемся дальше.
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 и вы можете писать программы на языках 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 .
Используя понятные имена выходных программ (исполняемых файлов), вы гарантируете себе простоту работы и сокращение времени на разбирательство спустя долгое время.
Программист, сооснователь programforyou.ru, в постоянном поиске новых задач и алгоритмов
Языки программирования: Python, C, C++, Pascal, C#, Javascript
Выпускник МГУ им. М.В. Ломоносова
А Вы знаете, что мы пишем программы на C, C++, C#, Pascal и Python?
Так что если Вам нужно написать программу на C/C++, C#, Pascal или Python — мы с радостью поможем с этим!
В том числе мы занимаемся репетиторством по информатике и программированию, а также готовим к ОГЭ и ЕГЭ!
Почему именно мы?
- Более 1800 выполненных заказов;
- Более 170 отзывов;
- Качественное решение
- Короткие сроки и привлекательные цены
- Различные акции и скидки
Как с нами связаться?
Programforyou — доверяя нам писать программы, вы получаете качественное решение в короткие сроки по привлекательной цене!