- Школа179
- 1. Инструкция по установке MinGW-w64
- 2. Установка и настройка Clion
- 3. Установка и настройка Code::Blocks
- How To Install MinGW on Windows
- Step 1 — Download MinGW
- Step 2 — Install MinGW-W64
- Step 3 — Install MinGW
- Step 4 — Getting started with C — Hello World
- Step 5 — Getting started with C++ — Hello World
- Is there an offline MinGW installer?
- 3 Answers 3
- MinGW-w64 offline installer
- 2 Answers 2
Школа179
MinGW – вариант компилятора GNU C/C++ для Windows. Он используется всеми сторонними средами разработки, кроме Visual Studio, у которой собственный компилятор. Среда разработки, как правило, не связана тесно с компилятором MinGW и может использовать несколько разных версий MinGW. Компилятор MinGW может распространяться и вместе со средой разработки, как, например, Code::Blocks.
Но, в частности, среда CLion требует отдельной установки MinGW. Вы можете взять MinGW из Code::Blocks, он находится в каталоге MinGW внутри каталога, куда был установлен Code::Blocks, то есть полный путь к компилятору MinGW может быть таким: C:\Program Files (x86)\CodeBlocks\MinGW\. Или вы можете установить более новую версию компилятора отдельно – в Code::Blocks версия MinGW, как правило, довольно старая.
1. Инструкция по установке MinGW-w64
1. Скачать установщик mingw-w64-install.exe отсюда и запустить его.
Нажимаем next. Установщик скачивает информацию о доступных пакетах MinGW.
2. На следующей странице вы можете выбрать, какой вариант MinGW устанавливать: версия компилятора (последняя доступная будет 7.2.0 на начало 2018 г.), архитектуру (можно заменить 32-битную архитектуру i686 на 64-битную x86_64), другие параметры менять не следует.
3. В следующем окне задается путь для установки компилятора. Запомните этот путь или укажите другой.
4. Установщик скачивает нужные пакеты. Ждем завершения процесса.
5. Ждем появления сообщения «Click Next to continue the installation» и нажимаем Next.
6. Установка закончена.
После установки подкаталог bin каталога, куда был установлен MinGW, рекомендуется добавить в системную переменную PATH.
2. Установка и настройка Clion
Установка Clion никакой сложности не представляет. Жмём «Next» на всех экранах. Более сложна настройка CLion после запуска.
1. Здесь можно просто нажать OK. На других экранах, которые не упомянуты ниже, можно просто нажимать «Next».
file:clion1.png
2. Здесь нужно получить лицензию на использование Clion, для этого нужно ввести свой логин и пароль от кабинета на сайте jetbrains.com. Предварительно необходимо самостоятельно регистрироваться и получать лицензии на странице https://www.jetbrains.com/student/, при этом в качестве адреса электронной почты нужно указать адрес в домене @179.ru – тогда вы получите академическую лицензию на все продукты.
file:clion2.png
3. Здесь нужно добавить компилятор MinGW. Кликайте на ссылку MinGW.
file:clion2.png
4. На следующем экране нужно ввести выбрать путь к каталогу, куда установлен MinGW («Use MinGW home»). Дождитесь, пока clion определит версии компилятора и gdb.
file:clion4.png
5. На следующих экранах настраиваются дополнительные плагины, они вам не нужны, просто жмем Next.
3. Установка и настройка Code::Blocks
1. Рекомендуется скачивать Code::Blocks, содержащий компилятор MinGW, а потом исправить настройки MinGW. Ссылка для скачивания: https://sourceforge.net/projec[..]w-setup.exe/download
2. Установка Code::Blocks затруднений не представляет.
3. При первом запуске Code::Blocks обнаруживает Gnu GCC Compiler – скорее всего встроенный. Его нужно заменить на установленный MinGW. Нужно открыть меню «Settings – Compiler», На вкладке «Toolchain exacutables» Compiler’s installation directory заменить на каталог с MinGW (например, C:\soft\mingw-w64\i686-7.2.0-posix-dwarf-rt_v5-rev1\mingw32)
How To Install MinGW on Windows
Provides all the steps required to install MinGW on Windows and getting started with C or C++ programming.
MinGW also called as Minimalistic GNU for Windows is a popular compiler for C and C++ and used for the development of native MS-Windows applications. It does not depend on any 3rd party tools or libraries but relies on the several DLLs provided by Microsoft as components of the operating system. Out of these DLLs, MSVCRT.DLL i.e. Microsoft C runtime library is the primary one. Apart from the system components, the threaded applications must use freely distributable thread support DLL, provided as part of MinGW itself. You may consider using Cygwin for POSIX application deployment.
Below listed are the features and components provided by MinGW. You may also refer MinGW for more details.
- A port of the GNU Compiler Collection (GCC), including C, C++, ADA and Fortran compilers;
- GNU Binutils for Windows (assembler, linker, archive manager)
- A command-line installer, with optional GUI front-end, ( mingw -get) for MinGW and MSYS deployment on MS-Windows
- A GUI first-time setup tool ( mingw -get-setup), to get you up and running with mingw -get.
In this tutorial, we will install MinGW on windows and write, compile, and execute our Hello World program in C++.
Step 1 — Download MinGW
Go to the Download Page to start downloading mingw -w64. It will show various download options as shown in Fig 1.
Download MinGW-W64-builds as highlighted in Fig 1.
You may also download and install MinGW Installation Manager in case you are planning only for the 32-bit compiler. The MinGW-W64 provides both 32-bit and 64-bit compilers.
Download MinGW Installation Manager as highlighted in Fig 2.
Step 2 — Install MinGW-W64
Now execute the MinGW-W64-builds executable downloaded by us in the previous step. It will show the welcome screen as shown in Fig 3.
Click on the Next Button to continue with the installation. It will show the settings screen as shown in Fig 4.
Note that I have selected x86_64 architecture in order to support 64-bit instructions. You may continue with i686 for 32-bit instructions. Also, I have selected the posix option of Threads settings for programs involving multithreading. You may select the win32 option based on your needs. Now click on the Next Button to continue with the installation. The next screen asks for the installation path as shown in Fig 5.
Make sure that you provide an installation path without any spaces. Now click on the Next Button to finish the installation.
It might show you error specific to fail to download. I tried a few times and got success in 3rd attempt. You may also continue with manual installation in case it failed multiple times. You can simply download the archive of MinGW-W64 and extract it to the desired location.
It will show the download progress and status as shown in Fig 6, Fig 7, and Fig 8.
Now click on the Next Button after download completes. It will show the success message as shown in Fig 9.
Click on the Finish Button to close the installer. Now add the bind directory of MinGW-W64 to the system path as shown in Fig 10.
Step 3 — Install MinGW
In this step, we will install the MinGW distributed by the official website as shown in Fig 2. Execute the installer downloaded in previous steps. It will show the welcome screen as shown in Fig 11.
Click on the Install Button to start the installation. It will ask for the installation directory as shown in Fig 12.
Click on the Continue Button to start the installation. It will show the progress as shown in Fig 13 and Fig 14.
Click on the Continue Button to launch the installation manger as shown in Fig 15.
Choose the package GCC as shown in Fig 16.
Click on the Apply Button to apply the changes as shown in Fig 17.
Click on the Apply Changes Button . It will show the confirmation message as shown in Fig 18.
Click on the Apply Button to install GCC. It will show the Package progress as shown in Fig 19 and Fig 20.
Click on the Close Icon and also close the installation manager to complete the installation of the compiler required to compile the programs.
You may add the MinGW path to bin directory which is C:\cpp\mingw\bin in my case to system path as we did for MinGW-W64. Make sure that you keep only one compiler path at a time among MinGW and MinGW-W64.
Step 4 — Getting started with C — Hello World
Write your first C program as shown below and save in a file hello.c.
Compile and execute the program using the command as shown below.
It will compile the program and generate the executable i.e. hello.exe. We can simply type hello to execute the program. It will print Hello World on the console as shown in Fig 21.
Step 5 — Getting started with C++ — Hello World
We can repeat the previous step to write the Hello World program in C++. Write your first C++ program as shown below and save it to hello.cpp.
Compile and execute the program using the command as shown below.
It will compile the program and generate the executable i.e. hello.exe. We can simply type hello to execute the program. It will print Hello World on the console as shown in Fig 22.
This is how we can install MinGW and MinGW-W64 and configure the system path to access the executables from the command line. We also wrote our first C and CPP programs, compiled and executed them to print Hello World on the console.
Is there an offline MinGW installer?
I am learning C and I want to install MinGW on my laptop. The MinGW installer is a web-installer, it requires the computer to have access to the internet when installing. But the problem is that my computer’s not connected to the internet. So it can’t be installed.
So I am thinking of downloading the complete offline installer on my smart-phone and transfering it to my PC through blue-tooth.
I have already tried TDM-GCC, but even that requires me to download somthing.
So is there an offline installer to MinGW? If yes where can I get it?
3 Answers 3
I did not find an offline installer for MinGW,but instead I found a better Windows port; which is MinGW-W64
Mingw-w64 is an advancement of the original mingw.org project, created to support the GCC compiler on Windows systems. It has forked it in 2007 in order to provide support for 64 bits and new APIs. It has since then gained widespread use and distribution.
Now to answer this question: it has to be mannually installed by downloading the zip file. It won’t require additional download.
You can download it from link : https://github.com/jonasstrandstedt/MinGW You need to extract the MinGW folder in C:\ eg: c:\MinGW . Then what you need to follow the steps given in the link above. In CodeBlock IDE go to settings>compiler>Tochain Executables. There you need to click on auto detect or specify the folder manually.
The most direct answer to the question «Is there an offline MinGW installer?» is «maybe, but it would be a snapshot from the past, and it’s almost certainly not up-to-date with the latest available released versions.» The individual packages are made available (almost) as soon as they’re released, so capturing everything in a self-contained installer is a moving target.
But, you can use the standard installer offline with a bit of prep work if you use MSYS2’s pacman , which manages dependencies and grabs all the right versions for you.
MinGW-w64 offline installer
is there any way to install mingw-w64 offline ? I tried many official sources and all of them seem to need some sort of internet access. I’m looking for something that works for both x32 and x64 systems. I tried to have a look at the official repository but I am not sure which files I need for this task.
Thanks in advance !
2 Answers 2
Although the following isn’t fully tested yet, an offline installer seems unnecessary. Based on some screenshots for a bug report, the online installer asks the following questions.
The first 5 options are used to choose a single download package. I don’t know about you, but I’ve no idea what to choose for threads and exceptions. Based purely on download stats, posix threads are used more than twice as much as win32, seh seems much more popular for 64-bit, dwarf for 32-bit, sjlj seems pretty unloved. I’m guessing 32-bit with posix and dwarf is the default.
To identify what the choices are, it uses a file repository.txt from this folder. That’s just a pipe-separated text file — 5 fields for those 5 main options, plus one for the URL of the package to download.
Incidentally, if anyone knows where to find the source code for the installer, I’d really appreciate a comment — I’ve hunted high and low, found e.g. bug reports, but not found the source of the installer. Sources for mingw-64 binary packages are easy enough to find, though.
The binary packages themselves are in subfolders of this folder (Win32) and this folder (Win64).
I’m not sure what the shortcuts the installer offers to create are for — this is MinGW-w64, not MSYS or MSYS2, so there’s no bash-based shell to provide shortcuts to. Probably they’re just Windows command prompt shortcuts with the path set up.
Other than that shortcuts issue, all you do is unpack the package to a suitable folder, make sure that the mingw32\bin or mingw64\bin folder is on the path somehow, and you should be done. I’ve already tested this with one of the 32-bit gcc-5.4.0 packages — g++ compiled a hello-world with no problems.
There are alternative third-party builds in subfolders starting from one step further out here (32 bit) and similar subfolders of different Toolchains targetting * folders for 64-bit and other builds. ray_linn has various builds that include Ada (and Objective C/C++?) support. rubenvb has some older GCC and Clang versions. dongsheng-daily looks like daily builds, even including experimental GCC 7.
If you need MSYS too, let me know in comments. I’ve been installing that offline (along with MinGW32) for some time, so I have a list of which packages to install. You need quite a few packages, it’s a pain getting them from SourceForge, but once you have them it’s mostly just unpacking again. There’s some minor «postinstall» to do — some file to create, mainly where to find MinGW, plus creating a shortcut to the shell. I have AutoIt scripts to do that — a bit of a mess, using inappropriate methods because they were what I knew in AutoIt at the time, but they work OK.
There’s MSYS2, but at first glance that’s another online-installing-assumed issue, using the pacman package manager — probably very convenient, but not for the minority who can’t use it.