Miicck
Miicck

Reputation: 192

gfortran compiler on windows powershell not creating executable

The title says it all really, I run gfortran to compile a simple test fortran program, it compiles with no errors; but when I run ls to look at the output, there is no executable created. I've tried with the -o option set as well.

enter image description here

The fotran program is a simple hello world

program test1
implicit none
print *, "Hello World!"
end program test1

(The gfortran I'm using is from the mingw release; I have aliased gfortran to c:/mingw/bin/gfortran.exe within powershell, but the same problem happens if I call it explicitly)

Has anyone had this problem before? I thought it might be a permissions issue but I can create files from powershell just fine (unless gfortran needs additional permissions for some reason?). Any help greatly appreciated, thanks :)

Upvotes: 0

Views: 2549

Answers (2)

PAEP
PAEP

Reputation: 121

I just happened to have the same problem that you described but two years later ...

enter image description here

I found that I just need to call the program as ./test.exe instead of test.exe, as I would have done with MS-DOS. That way I do not have to change the path if I work in a different folder.

Upvotes: -1

Miicck
Miicck

Reputation: 192

Turns out simply aliasing the path to the compiler doesn't work in powershell for MinGW, adding the mingw bin directory to the path is necessary and solved my problem as @cup suggested in the comments. Thanks everyone :)

Upvotes: 2

Related Questions