g77 include files
by Juliet Kemp
The error message was pretty clear that the problem was with
g77not being able to find the relevant include file - but there it was, right in the directory.
It transpired after a little Googling that
g77(at least as of the version in etch) doesn't use the current directory or the source file directory to look for include files in. The problem was readily solved by adding
-I.(note the dot!) in the
configurefile & running
However, this seems to me to be a strange decision - for my intuition, looking in the current directory and in particular the source file directory for desired files makes sense. I can't offhand find anything explaining why it works this way; and the fact that this code used to work fine implies that it's not "it's always been done this way" (although I've now upgraded all machines to etch so haven't got a sarge box kicking around to test!).
There's a bug report for
gfortranstating that it does include files in the current working directory while
g77doesn't (with a patch fixing the problem); but this also states that
g77includes files in the same directory as the source file; which doesn't actually seem to be the case with this version. Curious.
(yes, we do still have people using Fortran here. Lots of people, in fact!)
|It's consistent with . not being in the default search path for executables. Regarding that, I understand it's a security issue; the choice of command to be executed shouldn't depend on your current working directory. Maybe the thinking here is along the same lines.|
|I can understand it with executables, but it doesn't seem as far as I can see to be the same sort of problem with include files. Unless it's just supposed to *match* the executables thing.|
In C, there are two different syntaxes:
if you want the search path to begin with the current directory, and
if you don't.
Does Fortran offer two different #include syntaxes too?