Anda di halaman 1dari 2

GFortranBinariesWindows - GCC Wiki http://gcc.gnu.

org/wiki/GFortranBinariesWindows

gfortran binaries for Windows


Stand-alone gfortran binaries for Windows are available as an installer. Download the
installer, and run it (accept the GNU Public License, choose an directory to install gfortran,
and let it work for you!). The installer sets your PATH environment variable, so that simply
typing gfortran in a command prompt will run the compiler.

Please report any bugs to the fortran@gcc.gnu.org mailing-list.

Troubleshooting
I installed gfortran, and now what?

gfortran is now available from command-line. To open a command prompt, click on Start
menu, choose Accessories and then Command Prompt, or choose Run and type "cmd". In the
black window that opens, you can use gfortran to compile your Fortran code (assuming your
program is file code.f95 in the current directory): gfortran code.f95 -o code.exe
This creates an executable named code.exe.

When I type try to run gfortran, windows says "command not found"

The installer tries to add the gfortran program to your PATH environment variable, telling
Windows where to look when you call for gfortran For this to work, the command prompt
window must be openedafter the installation is complete Open a new prompt window, and try
again!

I opened a new command prompt, after the installation completed, and it


still says "command not found"

Check that you have indeed files in the directory you selected for installation (if you chose
c:\gfortran as installation directory, you should have directories like
c:\gfortran\bin c:\gfortran\include ... you should also have a file
gfortran.exe in c:\gfortran\bin .

Now we have to tell Windows to look in c:\gfortran\bin for the compiler. Right click
on My Computer, Properties, Advanced Tab, Environment Variables.

In the top section labeled "User variables for..." there may or may not be an entry called
PATH. If there is, click on it, click edit, then add the following at the end of the line.

;c:\gfortran\bin

If there is not, click add.

1 of 2 1/7/2008 5:11 PM
GFortranBinariesWindows - GCC Wiki http://gcc.gnu.org/wiki/GFortranBinariesWindows

Variable Name: PATH


Variable Value: c:\gfortran\bin

Click okay enough times to get back to the desktop, and open a new command prompt. You
can do this by either going to Start, Accessories, Command Prompt, or by clicking run, and
typing in cmd .

None: GFortranBinariesWindows (last edited 2007-12-01 20:12:32 by FxCoudert)

2 of 2 1/7/2008 5:11 PM