This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Preprocessor statements in 'include'd files


Hi,

is it possible to use preprocessor statements in included files?

An example:

a.f:
      program hallo
      
      include 'sdf'
#ifdef ASD
      write(*,*) 'HalloASD'
#else
      write(*,*) 'Hallo'
#endif
      end

sdf:
      INTEGER sdf
#ifdef ASD
         PARAMETER (sdf=1)
#else
         PARAMETER (sdf=2)
#endif

So, when i try to compile it with:
gfortran -x f77-cpp-input -DASD a.f
i get following error messages:
Warning: sdf:2: Illegal preprocessor directive
Warning: sdf:4: Illegal preprocessor directive
Warning: sdf:6: Illegal preprocessor directive
 In file sdf:5

     Included at a.f:2

            PARAMETER (sdf=2)                                           
                           1
Error: PARAMETER attribute conflicts with PARAMETER attribute at (1)

tia & best regards,
schamil

ps: please cc on reply



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]