Unfortunately, the MinGW-w64 installer you used sometimes has this issue. I myself am not sure about why this happens (I think it has something to do with Sourceforge URL redirection or whatever that the installer currently can’t handle properly enough).
Anyways, if you’re already planning on using MSYS2, there’s no need for that installer.
Download MSYS2 from this page.
After the install completes, click on the newly created “MSYS2 Shell” option under either
MSYS2 32-bitin the Start menu (or
mingw32.exein the installation directory).
If done correctly, the terminal prompt will say
Update MSYS2 using
pacman -Syuu. If it closes itself during the update, restart it and repeat the same command to finish the update.
You should routinely update your installation.
Install a toolchain
a) for 64-bit:
pacman -S mingw-w64-x86_64-toolchain
b) for 32-bit:
pacman -S mingw-w64-i686-toolchain
This includes GCC (the compiler), GDB (the debugger), and more.
Install any libraries/tools you may need. You can search the repositories by doing
pacman -Ss name_of_something_i_want_to_install
pacman -Ss gsl
and install using
pacman -S package_name_of_something_i_want_to_install
pacman -S mingw-w64-x86_64-gsl
and from then on the GSL library will be automatically found by your compiler!
Make sure any compilers and libraries you install have this package prefix (
mingw-w64-x86_64-for 64-bit or
mingw-w64-i686-for 32-bit). Only use unprefixed packages for misc command-line utilities (such as
make, etc), unless you know what you’re doing.
Verify that the compiler is working by doing
If you want to use the toolchains (with installed libraries) outside of the MSYS2 environment, all you need to do is add
<MSYS2 root>/mingw64/bin or
<MSYS2 root>/mingw32/bin to your