How install MinGW-w64 on Windows 10 or 11 using MSYS2

DevNotes
By -
0

1. Install the MSYS2 Environment


MSYS2 provides a package manager called pacman that makes it easy to install and update the compiler.
MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software



2. Install the MinGW-w64 Toolchain

pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain




When prompted for which packages to install, press Enter to select all.





Type Y and press Enter when asked to proceed with the installation.




3. Set Your System Environment Variables

To use the gcc or g++ commands in a regular Command Prompt or VS Code, you must add the folder to your Windows Path.

  1. Search for "Edit the system environment variables" in the Windows taskbar and open it.

  2. Click Environment Variables > find Path under "System Variables" (or User variables) > click Edit.

  3. Click New and paste the following path: D:\Program Files\msys64\ucrt64\bin

  4. Click OK on all windows to save.

4. Verify the Installation

Open a new Command Prompt or PowerShell window and type:
gcc --version
g++ --version


Tags:

Post a Comment

0 Comments

Post a Comment (0)
3/related/default