ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Imultiplication_q2,Rmultiplication_q2
1
Error: Ambiguous interfaces 'rmultiplication_q2' and 'rmultiplication_q' in intrinsic '*' operator at (1)
make: *** [mod_quaternion.o] Error 1
I know I'm not giving a lot of details here; but could anyone shed some light as to what the problem might be? Especially the part about the ambiguous interfaces.
That's the FORTRAN compiler's way of telling you it's confused about how you want to multiply "i * x". It knows "i" is an integer, and it knows "x" is some kind of real ... but it wants you to better specify exactly what kind of "real".
interface operator ( * )
module procedure Imultiplication_q,Rmultiplication_q,&
multiplication_q,multiplication_q2,&
Imultiplication_q2,Rmultiplication_q2
end interface
function Imultiplication_q(i,q1)result(q)
implicit none
integer,intent(in)::i
type(quaternion),intent(in)::q1
type(quaternion)::q
q%a=i*(q1%a)
q%v=i*(q1%v)
end function Imultiplication_q
function Imultiplication_q2(q1,i)result(q)
implicit none
integer,intent(in)::i
type(quaternion),intent(in)::q1
type(quaternion)::q
q%a=i*(q1%a)
q%v=i*(q1%v)
end function Imultiplication_q2
function Rmultiplication_q(a,q1)result(q)
implicit none
real(kind=double),intent(in)::a
type(quaternion),intent(in)::q1
type(quaternion)::q
q%a=a*q1%a
q%v=a*q1%v
end function Rmultiplication_q
function Rmultiplication_q2(a,q1)result(q)
implicit none
real(kind=double),intent(in)::a
type(quaternion),intent(in)::q1
type(quaternion)::q
q%a=a*q1%a
q%v=a*q1%v
end function Rmultiplication_q2
I'm pretty sure it's declared; kind=double. Is there anything else I should try?
Sorry - I didn't realize that *you* were trying to code "explicit interfaces". I thought you were trying to get some legacy F77 (or older) code to compile in a Fortran 90/95 environment.
I don't have any experience with explicit interfaces (new, I believe, in Fortran 90). Here are a couple of links that might help:
PS:
Maybe the problem would go away if you *didn't* use the explicit interfaces. Or at least didn't attempt to override any operators - but used functions, instead.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.