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

error #6457 This derived type name has not been declared

Clarence_N_
Beginner
4,651 Views

Hi All,

I recently met a problem with error message "error #6457: This derived type name has not been declared.   [DRTYP]" in my code.

module derivetypetest
    implicit none
!DEC$ IF DEFINED (abc)
         type StringPointer
            character (len=1), pointer :: sp
         end type StringPointer
!
         type drtyp
            integer dim, size
            integer (kind=IntKind), pointer :: array(:,:)
         end type drtyp
!DEC$ ELSEIF DEFINED (def)
         type drtyp
            integer size
            integer (kind=IntKind), pointer :: array(:)
         end type drtyp
!
         character (len=1), private, allocatable :: whatever(:)
!DEC$ ENDIF    
         private :: drtyp
         type(drtyp), private:: drtyparr(5)

        
end module derivetypetest

 

A workarround I used is that I put

         private :: drtyp
         type(drtyp), private:: drtyparr(5)

in !DEC$ IF and !DEC$ ELSEIF.

May I ask if there's other option to keep the codes in the original form?

 

0 Kudos
2 Replies
JVanB
Valued Contributor II
4,651 Views

If neither abc nor def is defined, you should expect that error message. Maybe you could put a !DEC$ ELSE clause in there that defines TYPE(drtyp) in that case.

 

0 Kudos
Clarence_N_
Beginner
4,651 Views

Thanks! This works.

Repeat Offender wrote:

If neither abc nor def is defined, you should expect that error message. Maybe you could put a !DEC$ ELSE clause in there that defines TYPE(drtyp) in that case.

 

0 Kudos
Reply