Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

How to define a constant and use as array dimension in INCLUDE file?

paramont
Beginner
816 Views
I defined a constant in INCLUDE like this:
integer xxxxx
parameter (xxxxx=10)

real*4 aaa(xxxxx)

COMMON /BB/ aaa

I got error message like this after I compile the project:
This name cannot be assigned this data type because it conflicts with prior uses of the name [xxxxx].
The dimensions of this array have been defined more than once. [aaa]

However, it is not defined elsewhere.

Thanks!
0 Kudos
3 Replies
jlmartin
Beginner
816 Views
Did you ever find out what was wrong with this? I've been having the same trouble....
0 Kudos
Steven_L_Intel1
Employee
816 Views
Do you have a small but complete example? Please attach it here.
0 Kudos
jlmartin
Beginner
816 Views
Actually, I figured it out, and it might help this other guy--a subroutine that passes an argument X used to define an array size (say, A(X,X)) will apparently decide on a type for that argument when it first sees the array A defined; if the argument X is defined AFTER that, FORTRAN returns an error. So
SUB1 (A,X)
IMPLICIT REAL
REAL A(X,X)
INTEGER X
doesnt work, while
SUB1 (A,X)
IMPLICIT REAL
INTEGER X
REAL A(X,X)
does. This might be related to the problem that seemed to be an INCLUDE file error.
0 Kudos
Reply