Problems with Fortran INCLUDE and Preprocessor
Tobias.Schlueter@Physik.Uni-Muenchen.DE
Tobias.Schlueter@Physik.Uni-Muenchen.DE
Tue Aug 16 17:03:00 GMT 2005
Quoting Douglas Vechinski <douglas.vechinski@dynetics.com>:
> attempting to compile with g77 -O ex.F results in an error that ex.par
> can not be found on the 3.4 version. The older 2.96 version works fine.
> However if you first perform g77 -E ex.F > junk.f and then g77 -O junk.f
> there are no problems. Does some know what the problem is.
>
> (Yes I realize that this example does not use any C preprocessing
> directives but it illustrates the problem for code when I do have some C
> prepocessing directives).
This is a really stupid bug: the preprocessed is written to a temporary file,
which is usually put into /tmp. When running the compiler on the preprocessed
output, it then looks for the included file in the same directory as the source
file, which then is of course /tmp. This fails. An easy workaround is to use
the -pipe command line option, because then the compiler doesn't make use of a
temporary file. Alternatively, you could probably add the source directory to
some include search path, but I don't know g77 well enough to tell how that is
doene.
HTH,
- Tobias Schlueter
More information about the Fortran
mailing list