실제 서브 루틴을 유형 바인드 프로 시저 및 유형 정의 뒤에 다른 파일에 둘 수 있는지 궁금합니다. EG :다른 파일에있는 OOP 포트란, 유형 및 절차
파일 A :
Module TypeDef
Type :: Test
Integer :: a,b,c
contains
Procedure, Pass, Public :: add => SubAdd
End Type
Type(Test) :: Test
Interface
Subroutine SubAdd(this)
Import TypeDef
Class(TypeDef), Intent(InOut) :: this
End Subroutine
End Interface
End Module
파일 B :
: 첫 번째 다음 파일 B 파일을 컴파일 할 때,ifort
오류 메시지를 제공하기 때문에
Module TypeRoutines
use TypeDef
Private :: SubAdd
contains
Subroutine SubAdd(this)
Class(TypeDef), Intent(InOut) :: this
this%c=this%a+this%b
End Subroutine
End Module
이 작동하지 않습니다
The name of the module procedure conflicts with a name in the encompassing scoping unit
이것이 주된 이유는 어떤 유형의 경우 많은 유형의 바운드 프로 시저를 작성해야한다는 것입니다 몇 가지 파일이 수백 줄에 걸쳐 확장되어 작업이 매우 지루합니다. 궁극적 인 목표는 모든 단일 서브 루틴을 다른 파일에 배치하는 것입니다.
아이디어가 있으십니까?