1. Install Cygwin (https://cygwin.com/install.html)
2. Install Required Cygwin Packages
C:\cygwin64>setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel
3. Download, Build and Install the Latest GCC
Open a Cygwin terminal
wget http://ftpmirror.gnu.org/gcc/gcc-9.1.0/gcc-9.1.0.tar.gz
tar xf gcc-9.1.0.tar.gz
That will create a subdirectory named gcc-4.9.2. Next, we’ll configure our GCC build.
mkdir build-gcc
cd build-gcc
../gcc-9.1.0/configure --program-suffix=-9.1.0 --enable-languages=c,c++ --disable-bootstrap --disable-shared
Next, we’ll actually build the new GCC compiler suite, including C, C++ and the standard C++ library. This is the longest step.
make -j4
The -j4 option lets the build process spawn up to four child processes in parallel.
Once that’s finished, install the new compiler:
make install
cd ..
https://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/