Install gfortran on bash ubuntu windows 10
WSL does not run Linux GUI programs by default, and I find editing source code on it inconvenient. For now I am storing data files in the same directory as the code. Using the get_command_argument of Fortran 2003, you could determine at run-time whether Windows or WSL is being used (is the executable a.exe or a.out?) and translate Windows directories to WSL when needed. If you have data files in c:\data, your WSL program needs to translate that into /mnt/c/data. You do not need to make separate copies of source code for Windows and WSL. What is c:\fortran on Windows is /mnt/c/fortran on WSL. On WSL, you can see the Windows file system. I am pleased that on WSL, my program compiled by gfortran run faster and more robustly. Great! With other inputs, the program on Windows takes 31 s with gfortran and 24 s with Intel Fortran, but it only takes 17 s with gfortran on WSL (all programs compiled with -O2). That program, with the same inputs, runs fine with gfortran on WSL. One of my programs compiled with GNU Fortran (GCC) 8.0.0 20170430 from freezes on Windows for certain inputs. There are more recent versions of gfortran that I will look into installing on WSL.
#INSTALL GFORTRAN ON BASH UBUNTU WINDOWS 10 INSTALL#
Then you can install gfortran 4.8.4 using sudo apt-get install gfortran. You can install WSL on Windows 10, which gives you a bash terminal. Here are my impressions, which are positive. I just tried Windows Subsystem for Linux (WSL) to run Fortran programs.