Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Include file compilation.

Hello everyone,

I ported some code which was running with compaq visual fortran into a linux system.

Here is a seemingly simple problem which taken sometime of mine. So I thought it may be useful to post in forums.

Here is an include file, which includes a named COMMON block.
[fxfortran]      COMMON /CKSTRT/ NMM , NKK , NII , MXSP, MXTB, MXTP, NCP , NCP1,
     &                NCP2, NCP2T,NPAR, NLAR, NFAR, NLAN, NFAL, NREV,
     &                NTHB, NRLT, NWL,  NRNU, NORD, MXORD,IcMM, IcKK,
     &                IcNC, IcPH, IcCH, IcNT, IcNU, IcNK, IcNS, IcNR,
     &                IcLT, IcRL, IcRV, IcWL, IcFL, IcFO, IcKF, IcTB,
     &                IcKN, IcKT, IcRNU,IcORD,IcKOR,NcAW, NcWT, NcTT,
     &                NcAA, NcCO, NcRV, NcLT, NcRL, NcFL, NcKT, NcWL,
     &                NcRU, NcRC, NcPA, NcKF, NcKR, NcRNU,NcKOR,NcK1,
     &                NcK2, NcK3, NcK4, NcI1, NcI2, NcI3, NcI4


This file when compiled with 'ifort -c' or 'ifort -free -c' gives following error:

------------------------------- ERROR--------------------
ckstrt.f(10): error #5082: Syntax error, found END-OF-FILE when expecting one of:
0 Kudos
3 Replies
New Contributor I
The COMMON statement must be followed by something, at least an END statement.

If you get errors when INCLUDE-ing this file, it could be that your main code is free-format, and this file is fixed format. If so, and you need the include file to be compatible with fixed and free format, you can add an ampersand at column 73 for all but the last line. The result is an "intersection" format that is compatible with both forms. Column 73 is ignored in fixed format, and seen as a continuation in free format..
Black Belt
By itself, the file that you showed is not a complete program unit (subroutine, function, block data or program) and, therefore, is not compilable on any operating system with any compiler.

To avoid compiling an include fragment, one often gives the file a name with a file-type other than .f, .for or .f90; for example, .inc.

If you showed a valid source code in which this file is INCLUDEd, and you ran into problems compiling it, that would have been something worthwhile to post here.
Thanks Joe and Mecej,
Both of you are right. I got confused by its "extension". The file comes with a commercial software.
It does not need be compiled.