Topic: Variable is not declared or conflicts

This may be too long a question. But here goes.

I’m compiling a project in Windows called ModTran3 with 10 *.f files and am constructing a missing include file called “parameter.list”. Here is the beginning of the 5th file called “f-MT3a-driver.server.f”. Note the variable NSPEC at the end of line = driv 130.

       SUBROUTINE DRIVER                                                 driv 100
      include 'parameter.list'
      COMMON RELHUM(laydim),HSTOR(laydim),ICH(4),VH(17),TX(65),W(65)    driv 110
      COMMON IMSMX,WPATH(laythr,65),TBBY(laythr),PATM(laythr),NSPEC,     driv 130
     x KPOINT(12),ABSC(5,47),EXTC(5,47),ASYM(5,47),VX2(47),AWCCON(5)    driv 140


In parameter.list, I tried 4 options concerning NSPEC. None of them work.

c1    ! Do Nothing
c2      parameter(nspec=12)
c3      nspec=12
c4      integer nspec/12/

c    Some computations using nspec
      PARAMETER(NSPECX=13, NSPECT=NSPEC+NSPECX)
      PARAMETER(NSPEC2=2*NSPEC, NSPECX2=2*NSPECX, NSPECT2=2*NSPECT)

c End of parameter.list

----------------------------------
Option c1 (i.e., do nothing) gives this error:

Compiling .\f-MT3a-dpdisort.f
parameter.list:15:34:

       PARAMETER(NSPECX=13, NSPECT=NSPEC+NSPECX)
                                  1
Error: Parameter 'nspec' at (1) has not been declared or is a variable, which does not reduce to a constant expression
parameter.list:16:30:

Option c2 gives this error:

Compiling .\f-MT3a-driver.server.f
.\f-MT3a-driver.server.f:4:67:

       COMMON IMSMX,WPATH(laythr,65),TBBY(laythr),PATM(laythr),NSPEC,     driv 130
                                                                   1
Error: PARAMETER attribute conflicts with COMMON attribute in 'nspec' at (1)


Option c3 gives this error:

Compiling .\f-MT3a-dpdisort.f
parameter.list:16:34:

       PARAMETER(NSPECX=13, NSPECT=NSPEC+NSPECX)
                                  1
Error: Parameter 'nspec' at (1) has not been declared or is a variable, which does not reduce to a constant expression
parameter.list:17:30:

Option c4 gives this error:

Compiling .\f-MT3a-dpdisort.f
parameter.list:16:34:

       PARAMETER(NSPECX=13, NSPECT=NSPEC+NSPECX)
                                  1
Error: Parameter 'nspec' at (1) has not been declared or is a variable, which does not reduce to a constant expression
parameter.list:17:30:

Any help?

Re: Variable is not declared or conflicts

constants (a parameter is a named constant) can not be in a common block; just variables

You put a variable name in a common block, and equate the variable to a parameter to somewhat get the same effect.

The code is a good reminder to me of how nice the newer features of Fortran 90 and beyond are.

Re: Variable is not declared or conflicts

Okay, I'll try to avoid those problems.