I have installed CYGWIN interface with a GNU fortran 77 compiler on my system.
When I want to compile a file with this compiler I have to navigate to the folder that the source file is. The question is that how I can compile an arbitrary Fortran code from any where simply refering to its location. For more details please follow these commands that I quote from my cygwin command windows:
--------------------------------------------------------------------------------------------------
farzi@farzi-PC /cygdrive/c/a
$ dir
mytest1.f
farzi@farzi-PC /cygdrive/c/a
$ g77 mytest1.f -o mytest1
farzi@farzi-PC /cygdrive/c/a
$ ./mytest1
Enter number of equations (up to 1000): 5
exact = 0.0666666667
Max. difference was 0.000000000000% of the exact in eq. No. 1
Solution of the linear system of 5 equations took 0.00 seconds
Want to run again (y/n) ? : n
------------------------------------------------------------------------------------------------
The compile is successful(after navigation to the source folder in c:\a).
However, note the following alternative:
-------------------------------------------------------------------------------------------------
farzi@farzi-PC /cygdrive/c
$ /cygdrive/c/a/g77 mytest1.f
-bash: /cygdrive/c/a/g77: No such file or directory
farzi@farzi-PC /cygdrive/c
$ g77 /cygdrive/c/a/mytest1.f
g77.exe: /cygdrive/c/a/mytest1.f: No such file or directory
-------------------------------------------------------------------------------------------------
This time the g77 fails to compile the sample code.
How I can resolve this problem?