MinGW-W64 download, installation and configuration (support the latest version of GCC, currently GCC 13.2.0)

1. Introduction

1. Differences and connections between MinGW and MinGW-W64

Both MinGW and MinGW-W64 are lightweight GNU toolchains for the Windows platform for developing and compiling C and C++ programs.

MinGW (Minimalist GNU for Windows) is a 32-bit GNU toolchain that provides a GNU-based development environment, including the GCC compiler and some GNU libraries, which can be used to compile C and C++ programs under Windows. But MinGW only supports compilation of 32-bit programs.

MinGW-W64 is a 64-bit GNU tool chain, which is an upgraded version of MinGW. It was originally a branch of MinGW, and later became an independent development project. It supports compiling 32-bit and 64-bit programs at the same time. It includes a series of GNU libraries and tools, such as GCC, Binutils, GDB, etc., and also supports some utility tools and libraries, such as OpenMP, MPI, etc.

In general, MinGW-W64 can be regarded as an upgraded version of MinGW, which supports more compilation options and more libraries, and can compile more efficient and secure programs.

In addition, MinGW-W64 was originally an independent project forked from the MinGW project. MinGW has stopped updating for a long time, the highest version of built-in GCC is 4.8.1, and MinGW-W64 is still being maintained, and it is also recommended by the official website of GCC.

For more information about MinGW and MinGW-W64:

MinGW-w64 official website: MinGW-w64

GCC官网:GCC, the GNU Compiler Collection - GNU Project

2. Introduction to MSVCRT and UCRT

Both MSVCRT and UCRT are C runtime libraries for the Windows platform, providing basic C functions and types for the development and operation of C programs.

MSVCRT (Microsoft Visual C Runtime) is a runtime library used by early versions of Microsoft Visual C++ to support the running of C programs. It provides some commonly used C functions, such as printf, scanf, malloc, free, etc. MSVCRT can only run on 32-bit Windows systems, and does not support 64-bit systems and Windows Store applications.

UCRT (Universal C Runtime) is a new C runtime library introduced in Windows 10 to support the running and development of C programs. UCRT provides some new C functions, and also supports Unicode character sets and security functions, such as strcpy_s, strcat_s, _itoa_s, etc. UCRT supports both 32-bit and 64-bit systems and works with Windows Store apps.

In general, UCRT is a new generation of C runtime library developed by Microsoft to better support Windows 10 and Windows Store applications. Compared with MSVCRT, UCRT provides more functions and better compatibility. But for older 32-bit Windows systems, MSVCRT is still required.

Two, download

MinGW-w64 changelog:

MinGW-w64 source address:

If you are interested in the source code or want to compile MinGW-w64the application from source code yourself, the above source code is for you to use.

If your github is unstable, you can refer to: Several Github acceleration artifacts

There is no official binary installer available anywhere.

Where can I find MinGW-w64binary applications?

Here are several ways:

1. Download from sourceforge.net

Online installation is not recommended, the installation process is very slow and may fail!
Note: The binary installer provided here is old, and the supported GCC version stays at "MinGW-W64 GCC-8.1.0"

Up to now, the latest version of GCC is: GCC-13.2
For details, please refer to: GCC Releases - GNU Project

If you have specific needs and need to use an older version, you can refer to the following articles for installation and configuration:

2. Download from github

For online installation, you need to download mingwInstaller.exe (Installer of MinGW-W64 with GUI) first , which will be introduced later

3. Download from a mirror site

A MinGW-w64 mirror site found on the Internet (I don’t know where it is provided, it’s over)
http://files.1f0.de/mingw/
insert image description here

4. Compile it yourself

MinGW-w64Direct compilation will be more complicated. Here are a few compilation tools written by great masters :

how to use? See the corresponding Readme introduction, which is not covered in this article.

3. Installation and configuration

1. Online installation

The online installation on the Internet is not introduced here sourceforge.net, the GCC version on it is too old

Here is the online installation method of Releases · Vuniverse0/mingwInstaller (github.com) :

1) Download mingwInstaller.exe
download installer
2) Run as an administrator mingwInstaller.exeto start the installation
installation guide
3) Select the GCC version
Note: Releases Vuniverse0/mingwInstaller (github.com) has several versions mingwInstaller.exe, and different versions support different GCC versions. I use it here It is version 1.2.0
Select the gcc version
4) Select the software architecture Choose
32bit or 64bit, depending on how many bits your own operating system has (Such as Linux, Unix, Mac OS, etc.) Just choose. For more information, please refer to: mingw-w64-threads-posix-vs-win32 6) Select the build version Select the build version, there seems to be only one , generally keep the default 7) Select the type of runtime library Select the type of runtime library, as described in the previous introduction 8) Select the installation location You can check it , it will be more convenient to use 9) Installation process (automatic download, decompression, installation configuration)
system structure

win32posix

Choose threading model

rev1
Choose build version


Choose runtime type

Create shortcut on Desktop
Choose where to install

Download and decompression process
The installation is complete

2. Offline installation

Download the compiled installation package from GitHub or the mirror site (the address is provided in [2. Download])

Take niXman/mingw-builds-binaries/releases as an example, offline installation is relatively simple, just download and decompress

1) Downloaded MinGW-w64installation package
Choose the appropriate installation package according to your own needs

  • 32-bit operating system, select i686, 64-bit operating system, select x86_64;
  • 13.1.0It is the version number of GCC, you need to look down for other versions;
  • win32It is a protocol for developing windows system programs, posixand a protocol for other systems (such as Linux, Unix, Mac OS). For more information, refer to: mingw-w64-threads-posix-vs-win32 ;
  • Exception handling model seh(new, only supports 64-bit systems), sjlj(stable, both 64-bit and 32-bit are supported), dwarf(better than sjlj, only supports 32-bit systems), more information reference: what-is-difference -between-sjlj-vs-dwarf-vs-seh/15685229 ;
  • msvcrt, ucrtruntime library type, please refer to the introduction section of the article for the introduction;
  • rt_v11runtime library version;
  • rev1build version;

Download the MinGW-w64 offline installation package

2) Find a place to decompress (remember this path, and configure environment variables later)

3. Environment configuration

1) If you follow [1. Online installation], you can directly open MinGW-W64-64bitthe shortcut (desktop or start menu) without configuring environment variables, and then you can directly use the gccetc. command in the opened command line window
Verify that MinGW-w64 installation was successful

2) If you follow [2. Offline installation], manually add the bin path in the decompressed directory to the PATHenvironment variables of the system. ), after configuration, you can use gccother commands in the working directory
(my decompression path here is: D:\Chen\MySoft\mingw64, the configured environment variable is the bindirectory path under this path)
Configure environment variables
Verify that MinGW-w64 is successfully installed

Four. Summary

  1. [ Download from sourceforge.net ] provides the installer, supports GCC 8.1.0, the version is too old, it is not recommended to download and install from here;
  2. [ 2. Download from github ], [ 3. Download from mirror website ], the installer provided in [3. Download from the mirror website] supports relatively new GCC versions, and it is recommended to download and install from here;
  3. If you want to compile and install the program yourself, you can compile and install the MinGW-w64 program you need from the tools recommended in [ 4. Compile by yourself ].

Guess you like

Origin blog.csdn.net/B11050729/article/details/132176767