How to install gcc on windows

How to install gcc on windows

Installing GCC

The latest version of this document is always available at https://gcc.gnu.org/install/. It refers to the current development sources, instructions for specific released versions are included with the sources.

This document describes the generic installation procedure for GCC as well as detailing some target specific installation instructions.

GCC includes several components that previously were separate distributions with their own installation instructions. This document supersedes all package-specific installation instructions.

Before starting the build/install procedure please check the host/target specific installation notes. We recommend you browse the entire generic installation instructions before you proceed.

Lists of successful builds for released versions of GCC are available at https://gcc.gnu.org/buildstat.html. These lists are updated as new information becomes available.

The installation procedure itself is broken into five steps.

Please note that GCC does not support ‘ make uninstall ’ and probably won’t do so in the near future as this would open a can of worms. Instead, we suggest that you install GCC into a directory of its own and simply remove that directory when you do not need that specific version of GCC any longer, and, if shared libraries are installed there as well, no more binaries exist that use them.

Copyright © 1988-2022 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled “GNU Free Documentation License”.

(a) The FSF’s Front-Cover Text is:

(b) The FSF’s Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.

Copyright (C) Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

How to Download and Install GCC Compiler in C for Windows PC

Updated June 11, 2022

How to Install GCC on Windows

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

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

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.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Run the downloaded installer and accept the default options to install GCC Windows file.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Step 4) Accept the terms and conditions

Accept the Agreement

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Keep the component selection default and click Next.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Step 6) Locate the installation path

You may change the installation folder and click Next.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Step 7) Find and double-click on the CodeBlocks icon

To launch Code::Blocks double click on the icon.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Step 8) Let it detect the compiler itself

It will detect the GCC compiler for Windows automatically, set it as default.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Associate C/C++ files with code::blocks

You will see the IDE Home screen.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

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:

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

3. For Debian and Ubuntu users, type and execute following command

4. To verify that the GCC has been successfully installed on the machine as we discussed earlier, execute the following command

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.

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.

how to install gcc on windows 7 machine?

I have MinGW on my windows 7 machine. I wish to install and use complete gcc for C compiler. I found there is no single pre-compiled ready-made installation file for this purpose. I checked the following page : http://gcc.gnu.org/install/ It is difficult and I find it above my level of understanding. Could any one please provide me step by step guidance along with links?

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

5 Answers 5

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

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:

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 mingw-w64-public@lists.sourceforge.net 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.

Как установить компилятор gcc / g++ для Windows. Установка gcc

15 декабря 2018

Время чтения: 5 минут

Для того, чтобы писать программы на C/C++ обычно достаточно установить какую-нибудь интерактивную среду разработки (IDE), например, Visual Studio или Eclipse, однако иногда (обычно в целях обучения студентов) требуется создавать программы в обыкновенном текстовом редакторе и компилировать приложение, используя консоль и компилятор gcc. В Unix системах он обычно установлен прямо «из коробки», а вот на Windows системах такой роскоши не наблюдается. Более того, у многих пользователей возникает множество проблем при установке компилятора. Поэтому нами было принято решение написать данную статью, чтобы помочь всем тем, кому пришлось или приходится мучаться с установкой этого компилятора на Windows.

0. Прежде чем поставить компилятор GCC

Если в окне консоли появилось сообщение с версией компилятора и другая информация о GCC (второй скриншот), значит компилятор уже установлен и больше дополнительно ничего делать не нужно. А вот если вывод командной строки такой:

— значит GCC ещё не установлен в системе, поэтому двигаемся дальше.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

1. Скачиваем установщик компилятора

Чтобы поставить GCC на операционную систему Windows, необходимо скачать установочный файл для него. Сделать это можно здесь: equation.com/servlet/equation.cmd?fa=fortran. Найдите в таблице версию компилятора, которая вам больше нравится (мы рекомендуем скачивать самую последнюю, на текущий момент — это версия 8.2.0) и скачайте установщик для вашей системы (32 или 64 бит).

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

2. Установка GCC

После того, как файл был скачан, откройте в проводнике папку, в которую был скачан установщик и запустите его, кликнув по файлу дважды левой кнопкой мыши. Появится окно, требующее подтверждения действия. В нём нужно выбрать да (иначе ничего ставиться не будет).

Установщик начнёт работу и отобразит окно с консолью, а также окно с бежевым фоном, в котором попросит прочесть и принять (или отклонить) лицензионное соглашение. Нажимаем Accept.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Теперь остаётся только дождаться окончания распаковки архивов и установки их на компьютер. Как только все файлы будут установлены, инсталятор сообщит об этом, после чего нужно будет нажать на кнопку Finish.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

3. Проверка установки

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Поздравляем! Теперь на вашем компьютере установлен компилятор GCC и вы можете писать программы на языках C и C++, а компилировать их через командную строку!

4. Бонус. Компиляция программ с помощью GCC

Что ещё за a.out? Непонятно!

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Используя понятные имена выходных программ (исполняемых файлов), вы гарантируете себе простоту работы и сокращение времени на разбирательство спустя долгое время.

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

Программист, сооснователь programforyou.ru, в постоянном поиске новых задач и алгоритмов

Языки программирования: Python, C, C++, Pascal, C#, Javascript

Выпускник МГУ им. М.В. Ломоносова

Programforyou — это сообщество, в котором Вы можете подтянуть свои знания по программированию, узнать, как эффективно решать те или иные задачи, а также воспользоваться нашими онлайн сервисами.

Install C/GCC Compiler for Windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

How to install gcc on windows. Смотреть фото How to install gcc on windows. Смотреть картинку How to install gcc on windows. Картинка про How to install gcc on windows. Фото How to install gcc on windows

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

The first step in learning any programming language is to have the required software installed in the system. In this tutorial, we will learn how to install C/GCC compiler in Windows.

Source Code Editors

Although, you may choose any basic text editor such as notepad for writing and editing source code of C, we recommend choosing one of the editors below.

Install C/GCC Compiler for Windows

Setting up PATH Variable for Windows

Once Codeblocks is installed, GCC compiler also gets installed with it. However, if we want to execute C programs from command prompt, we have to add its bin directory to the PATH variable.

That’s all for installing C/GCC compiler in Windows. We are ready now to explore coding features of C Programming.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *