Using Eclipse for Fortran

11.3k Views Asked by At

I have a brief question here about how to setup Eclipse for Fortran.

I have already downloaded "Photran" (the Fortran tool for Eclipse) and installed it. The problem I'm having is that every time I try to run a program I get a message that says "Launch failed. Binary not found." Then, I found out you have to "build" the file first, so when I tried to do that, I got a message in the console that says the following:

**** Build of configuration Debug for project Fortran2 ****

make all 
/bin/sh: gfortran: command not found
Building file: ../Src/helloworld.f90
make: *** [Src/helloworld.o] Error 127
Invoking: GNU Fortran Compiler
gfortran -funderscoring -I/usr/locl/bin -O0 -g -Wall -c -fmessage-length=0 -o "Src/helloworld.o" "../Src/helloworld.f90"

**** Build Finished ****

Does anybody have any pointers on how to get this working?

4

There are 4 best solutions below

0
Seegorkesolot On
ln -s /usr/local/gfortran/bin/gfortran /usr/bin/gfortran

This did the trick for me. Photran/Eclipse is now running with gfortran without complaints.

0
Brett Nelson On

You may need to install gcc-gfortran which you should be able to find with your package manager.

The gcc-gfortran package provides "gfortran" which is what actually compiles FORTRAN (at least it does on Fedora).

0
JamesFurness On

Are you on OSX?

If so I found the problem is that OSX does not pass the PATH variable to applications started through the GUI. So to get around this one should start eclipse from the terminal. This worked when I had the problem.

There is a way to set the path for GUI launched applications explained here, though I didn't follow this myself. http://overwatering.org/blog/2012/08/setting-path-osx-mountain-lion/

1
John On

The link method did not work for me in OSX 10.12.1 Sierra, but launching Eclipse from the Terminal does work (assuming that Eclipse.app is in Applications, type /Applications/Eclipse.app/Contents/MacOS/eclipse in the Terminal).