Problems with Fortran INCLUDE and Preprocessor

Richard E Maine Richard.Maine@NASA.GOV
Tue Aug 16 16:24:00 GMT 2005


On Aug 16, 2005, at 7:39 AM, Douglas Vechinski wrote:

> The problem is occurring with some *.F files that are first meant to be
> passed through the preprocessor....
> In these files, some subroutines also have a Fortran INCLUDE.

Mixing C preprocessing and Fortran includes in ways like this causes 
similar problems on may platforms. It is not g77-specific. Although it 
might work on some compilers, it is not portable to assume that the 
compiler will handle it for you.

> If I manually perform a g77 -E on
> the file to get the intermediate .f file and then run g77 on this file,
> it works fine.

Approaches like that are the most portable way of handling such mixes. 
(Well, even more portable is to avoid the mix, but there are times when 
it is useful.) One can write rules in a Makefile to avoid the pain of 
needing the manual steps.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain



More information about the Fortran mailing list