Hello, Jeffrey Kelling wrote:
gfortran [...] -x f95-cpp [...] -o etsf_io etsf_io.o gfortran gives a warning: Warning: Reading file 'etsf_io.o' as free form
The "-x" forces the compiler (driver) to handle the given files in the given format, overriding the suffix-based handling. Hence, the compiler reads the .o file as free-format Fortran file, which should be pre-processed by the C preprocessor ("cpp"). In Fortran, the common handling of compilers is to regard ".f90" files as free-form files - and ".F90" files as the same - except that those should additionally be processed by "cpp". In older gfortran versions, the only way to force the compilation with "cpp" for ".f90" files was to use "-x". Newer gfortran versions support the option "-cpp" which otherwise not affect the handling of file suffixes. Hence: Please replace "-x f95-cpp" by "-cpp" (unless you have an ancient gfortran). Otherwise: Remove "-x f95-cpp" at least when linking.
I am not familiar with fortran, so I am do not know what 'free form' means,
As Fortran dates back to the 50s, it was initially "written" (punched) into cards. Hence, the fixed-form format is adapted for those: If you punch a hole in the first column, it's a comment, maximally 72 characters per line are allowed, code has to start in column 7 as the first one are used for other purposes, spaces (outside strings) have no semantic meaning. As that's quite inconvenient, a free-form format was added, which feels more "natural", "modern": You can indent the lines as you want and spaces do have a meaning (which helps with diagnostic) - also, you can write longer lines. Except for the input format, both fixed/free form have all the language features - but the compiler has to know which one is used. Most compilers use the extension for it: ".f" for fixed form and .f90 for free form (as it was added in Fortran 90) - both forms are valid and fully supported in Fortran 90/95/2003/2008 and by gfortran. Tobias