Overload problem
- From: "leaf" <vuckerster@xxxxxxxxx>
- Date: 29 Aug 2006 22:59:33 -0700
I use g95 to compile the code below and met an error:
*Error:Ambiguous interfaces 'print_try4' and 'print_try3' in
generic
interface 'print_try'
at (1)*
How to solve this problem? Thanks in advance!
The following is my code:
PROGRAM main
IMPLICIT NONE
INTEGER,DIMENSION(:),ALLOCATABLE::try1
INTEGER,DIMENSION(:),POINTER::try2
INTEGER::i,j,k
INTERFACE print_try
MODULE PROCEDURE print_try3
MODULE PROCEDURE print_try4
END INTERFACE print_try
ALLOCATE(try1(10))
ALLOCATE(try2(10))
DO i=1,10
try1(i)=1
try2(i)=2
END DO
CALL print_try(try1)
DEALLOCATE(try1)
DEALLOCATE(try2)
CONTAINS
SUBROUTINE print_try3(a)
IMPLICIT NONE
INTEGER,DIMENSION(:),ALLOCATABLE::a
INTEGER::n,i
n=SIZE(a)
DO i=1,n
WRITE(*,*) n,a(i)
END DO
END SUBROUTINE print_try3
SUBROUTINE print_try4(b)
IMPLICIT NONE
INTEGER,DIMENSION(:),POINTER::b
INTEGER::n,i
n=SIZE(b)
DO i=1,n
WRITE(*,*) n,b(i)
END DO
END SUBROUTINE print_try4
END PROGRAM main
.
- Follow-Ups:
- Re: Overload problem
- From: Michael Metcalf
- Re: Overload problem
- From: Arjen Markus
- Re: Overload problem
- Prev by Date: Re: closing unit=5 and unit=6 and print *
- Next by Date: Re: closing unit=5 and unit=6 and print *
- Previous by thread: closing unit=5 and unit=6 and print *
- Next by thread: Re: Overload problem
- Index(es):
Relevant Pages
|