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

Error when compiling - 5082, 6404, 6054

cptfisher
Beginner
3,389 Views
Good Day,

I get the following errors when trying to compile and wondered if anyone could help.
All files are written in free form fortran.

filename.f90: error 5082: Syntax errorm found ',' when expecting one of )
blade = (1, 1, 1), (1, 1, 1, 1, 1, 1), (1, 1, 1), (1, 1, 1)
---------------^


Also I get the following errors:
filename.f90: error 6404: This name does not have a type, and must have an explicit type. [TEST]
adinputfile = test


filename.f90: error 6054: A CHARACTER data type is required in this context. [TEST]
adinputfile = test


Any input is greatly appreciated


0 Kudos
1 Solution
JVanB
Valued Contributor II
3,389 Views
#6404 is there because blade is a component of a user-defined type, not a variable.
#6594 is there because component Orientation of type Marker is a rank-2 array.
#6303 is a consequence of the other errors.

You don't need to specifiy the type of the array elements because the rules of intrinsic assignment will convert to the correct type. If some the the array elements have different type or kind than others, then you would need the REAL(ReKi):: in there, though.

So:

type(AeroConfig) AC
...
AC%Blade = [ &
Marker( &
Position = [1,1,1], &
Orientation = reshape( &
[1,1,1,1,1,1,1,1,1], &
[3,3] &
), &
TranslationVel = [1,1,1], &
RotationVel = [1,1,1] &
) &
]

If AC%Blade is already allocated, you could skip the outer square brackets above; for allocate on assignment though, the right hand side must be an array!
You don't need the component names in the type constructor above, but I think they make the code much more readable.

View solution in original post

0 Kudos
8 Replies
Steven_L_Intel1
Employee
3,389 Views
The assignment to blade you show is not valid Fortran. I can't deduce what you wanted that statement to say. It would help if you attached the whole source.

As for the other two errors, you (reasonably so) have IMPLICIT NONE (or are compiling with the /warn:declarations option) and have not added a declaration of variable TEST. Presumably it wants to be declared as a character type.
0 Kudos
cptfisher
Beginner
3,389 Views
Hi Steve,

Thanks for your help, I have fixed the other problems for now but still get the error 5082.

TYPE, PUBLIC :: AeroConfig
TYPE(Marker), ALLOCATABLE :: Blade(:)
REAL(ReKi) :: BladeLength
TYPE(Marker) :: Hub
TYPE(Marker) :: RotorFurl
TYPE(Marker) :: Nacelle
TYPE(Marker) :: TailFin
TYPE(Marker) :: Tower
TYPE(Marker) :: Substructure
TYPE(Marker) :: Foundation
END TYPE AeroConfig

TYPE, PUBLIC :: Marker
REAL(ReKi) :: Position(3)
REAL(ReKi) :: Orientation(3,3) ! Direction Cosine Matrix (DCM)
REAL(ReKi) :: TranslationVel(3)
REAL(ReKi) :: RotationVel(3)
END TYPE Marker

Blade has the 4 components listed above as type (marker). I'm just trying to put in simple values (all the 1's) to work on a subroutine that will eventually be part of a matlab interface/.mex file.
0 Kudos
Steven_L_Intel1
Employee
3,389 Views
Ok. What you want is this:

blade = Marker([REAL(ReKi)::1, 1, 1], [REAL(ReKi)::1, 1, 1, 1, 1, 1], &
& REAL(ReKi)::1, 1, 1], [REAL(ReKi)::1, 1, 1])

The errors were:
- Not using a structure constructor with the type name
- Using the wrong syntax for an array constructor for each component
- Using the wrong type of constants

I added the structure constructor, fixed the array constructor syntax - you could use (/../) instead of [..] but I like the newer syntax, and added the type specification so that all the constants would be converted to that type.
0 Kudos
cptfisher
Beginner
3,389 Views
Hi Steve,

Thanks for your help. Unfortunately now I get the following:
error 5082: syntax error, foudn END-OF-STATEMENT when expecting one of: % . = =>
adinit(adoptions, turbinecomponents, errstat)
---------------------------------------------------^

Also now I get the following for the variables that I don't understand since the type is stated:

Error 6404: This name does not have a type and must have an explicity type. [BLADE]
blade = Marker([REAL(ReKi)::1, 1, 1], [REAL(ReKi)::1, 1, 1, 1, 1, 1], &
^

Error 6594: The rank of an element in a structure constructor differs from the rank of the componenty of the derived type
blade = Marker([REAL(ReKi)::1, 1, 1], [REAL(ReKi)::1, 1, 1, 1, 1, 1], &
-------------------------------------------------------------^

Error 6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands.
blade = Marker([REAL(ReKi)::1, 1, 1], [REAL(ReKi)::1, 1, 1, 1, 1, 1], &
----------^
0 Kudos
JVanB
Valued Contributor II
3,390 Views
#6404 is there because blade is a component of a user-defined type, not a variable.
#6594 is there because component Orientation of type Marker is a rank-2 array.
#6303 is a consequence of the other errors.

You don't need to specifiy the type of the array elements because the rules of intrinsic assignment will convert to the correct type. If some the the array elements have different type or kind than others, then you would need the REAL(ReKi):: in there, though.

So:

type(AeroConfig) AC
...
AC%Blade = [ &
Marker( &
Position = [1,1,1], &
Orientation = reshape( &
[1,1,1,1,1,1,1,1,1], &
[3,3] &
), &
TranslationVel = [1,1,1], &
RotationVel = [1,1,1] &
) &
]

If AC%Blade is already allocated, you could skip the outer square brackets above; for allocate on assignment though, the right hand side must be an array!
You don't need the component names in the type constructor above, but I think they make the code much more readable.
0 Kudos
Steven_L_Intel1
Employee
3,389 Views
Sorry for missing that Blade was not a variable...
0 Kudos
cptfisher
Beginner
3,389 Views
Thanks alot for your help Steve. One more issue now is that there were problems using the type(aeroconfig)AC with too many compiling errors to use AC%blade.

I've tried using aeroconfig%blade with just having type(aeroconfig) as the declaration.
Now the only error I receive is #6478 a type-name must not be used as a variable. [aeroconfig]

I'm not sure why since the components are not variables.
0 Kudos
cptfisher
Beginner
3,389 Views
I fixed it by using turbinecomponents%blade.


Thanks alot for your help.
0 Kudos
Reply