I am trying to learn fortran90/95 for a class on vector and parallel scientific computation. I’m working on Windows Vista 32 bit and I downloaded (what I believe to be, anyway) the version of the gfortran compiler for my operating system from here.
To test if it was working, I wrote a hello world program as follows:
program testfortran
write(*,*) 'Hello world!"
end program testfortran
pretty much verbatim from a fortran tutorial. When I try to compile it:
gfortran testfortran.f90
it gives me the following response:
C:\Program files\gfortran\bin/1d.exe: cannot open output file a.exe: Permission denied
collect2.exe: error: 1d returned 1 exit status
As an engineer, pretty much all of my programming experience has been with interpreted languages like Matlab and I’m not very familiar with compiled languages. I don’t know if I’m just making a really dumb error or what. Any help would be greatly appreciated.
The
a.exe: Permission deniedmessage implies that you don’t have permission to write to the current directory. What directory istestfortran.f90in? Can you create a file in the same directory (say,echo hello > hello.txt)? Can you try it in a different directory? (It does seem odd, though; if you can createtestfortran.f90in that directory, you should be able to createa.exein the same directory.)Or perhaps, there’s already an
a.exefile in that directory, and you don’t have permission to overwrite it. TryAlso, your error message refers to
1d.exe. I would expect it to beld.exe, the linker. And your sample program has mismatched quotation marks:'Hello world!". It’s best to copy-and-paste your source code and any error messages rather than re-typing them.