Unexplained compile error

D:>gfortran -o d:\new.f90
gfortran: fatal error: no input files; unwilling to write output files
compilation terminated.

Why might I be getting this error?
new.f90 is there upon look up
Previously writing similar gave no errors
Sorry rooky

-o is for defining the output file (executable) name, so it can not be a .f90 (input source file).
Something like:
D:>gfortran d:\new.f90 -o new.exe
should be correct under Windows.

Without -o, the default output filename will be a.exe

set path=c:\users\pader\gcc\bin;%path%
D:>gfortran d:\today.f90 -o d:\today.exe
f951.exe: Warning: Nonexistent include directory ‘d:’ [-Wmissing-include-dirs]

Problems remain

Usually I compile in the same directory where the source files are located, so I don’t need to specify the full file name. What if you try

D:>gfortran today.f90 -o today.exe

3 Likes

Yes! your suggestion worked! Hope it will work next time as well . . . Bye Patrick.

Good. I suggest that you save your Fortran code in a directory such as d:\fortran or d:\fortran_code and move to the directory of your code when you compile. That will make it easier to find your Fortran code in the future.

1 Like