install MSYS2

post-install MSYS2

  • first, update system at the first time start up
    pacman -Syu
    
  • after finish, close(NOT Ctrl+c) the window and reopen again
  • update again
    pacman -Sy
    pacman -Syu
    
  • (optional) add host environment variable C:\msys64\mingw64\bin to PATH

install toolchain in MSYS2

pacman -S mingw-w64-x86_64-toolchain make
  • shadow gcc
    echo "alias gcc=\"x86_64-w64-mingw32-gcc\"" >> ~/.bashrc