Compile a *.f90 file using gfortran

Hi! I have started using fortran. I am working on a Mac OSX version 10.10. As the fortran compiler, I installed gfortran and to make sure it is properly installed, I tried to issue gfortran on terminal and I got

**gfortran:** **fatal error:** no input files

compilation terminated. 

as the text editor, I installed Atom 1.34.0. x64. I also installed some useful fortran packages like : language-fortran and lintel. I wrote this simplest script and I saved it as test.f90 :

program hello

        print *, "Hello, World!"

end program hello

But when I compile it from my terminal using :

Reyhanehs-MacBook-Pro:desktop reyhanehghh$ gfortran test.f90

nothing happens, no errors, no prints, nothing, the cursor just goes to the next line :

Reyhanehs-MacBook-Pro:desktop reyhanehghh$

I would be thankful if you could help me to get it compile.

If it doesn’t work outside of Atom, then your best bet is to find a forum dedicated to Fortran. While it’s possible someone here may recognise the issue, it’s unlikely and is not particularly relevant to Atom. Of course, if you get it working in the terminal but it still doesn’t work in Atom, then we may be able to help find what’s wrong. Until then, there could be any number of purely Fortran related problems we can’t help with.

1 Like

Atom only allows you to edit text files (including Fortran source code). It doesn’t know how to compile or run Fortran programs (though certain modules will help you). However, it looks like you compiled your program successfully in the terminal. Check if there is a file named a.out in your working directory. You should be able to execute it using ./a.out. In the future you can give non-default names to your executables with gfortran -o test test.f90.

Thanks @dpo! it worked perfectly when i executed the file!