For anyone still searching for a solution
https://stackoverflow.com/a/30071634/23307867
go to this one and follow @rubenvb's guide and/or follow this guide too, imo @rubenvb's guide is enough
Download and Install MSYS2:
▶ Visit the MSYS2 website and download the installer.
▶ Follow the installation instructions to set up MSYS2 on your system.
Run MSYS2 UCRT64 Named App Instance:
▶ which looks like this image
▶ Open the MSYS2 terminal by launching the ucrt64 named app instance from your start menu or desktop shortcut.
Update Package Database and Core System Packages:
▶ In the MSYS2 terminal, run the following command:
pacman -Syuu
▶ If the terminal closes during the update, reopen the ucrt64 instance and run the command again.
▶ The program may ask for your approval sevaral times asking you to typeY
Install Essential Development Tools and MinGW-w64 Toolchain:
▶ Run the following command to install the necessary packages:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
▶ just to let you know the --needed
option ensures that only outdated or missing packages are installed. The base-devel
package group includes essential development tools. according to internet.
Add binary folder to PATH:
▶ If you did not change the default installation path/folder your bin folder location should be this - C:\msys64\ucrt64\bin
add it to your system environment variables PATH.
Update MinGW-w64:
▶ To update MinGW-w64 in the future, repeat from step 3.
Verify the Compiler Installation:
▶ To check if the compiler is working, run the following command in the terminal:
gcc --version
g++ --version
gdb --version