LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2009, 10:52 AM   #1
tak.rliu
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Rep: Reputation: 0
Error: Ambiguous interfaces Fortran


I'm wrote a Fortran program to do analysis;

It seems to install fine on my OpenSuse 10.3; but when I try to compile it on my OpenSuse 11.0, it gives me this error after I type "$make"

gfortran -g -I"src/mod" -J"src/mod" -o src/obj/mod_quaternion.o -c src/derivedType/mod_quaternion.f90
src/derivedType/mod_quaternion.f90:455.47:

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.
 
Old 01-27-2009, 11:42 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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".

This link might help:
http://www.sesp.cse.clrc.ac.uk/Publi...re/node11.html
 
Old 01-28-2009, 09:36 AM   #3
tak.rliu
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Code:
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?
 
Old 01-28-2009, 01:08 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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:

http://www.physicsforums.com/showthread.php?t=237380
http://books.google.com/books?id=40U...A468#PPA458,M1

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.

Just a thought .. PSM

Last edited by paulsm4; 01-28-2009 at 01:10 PM.
 
Old 01-29-2009, 08:27 AM   #5
tak.rliu
LQ Newbie
 
Registered: Jan 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Haha; thanks anyways, I figured it out.

Explicit Interfaces are the way of the future for Fortran.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fortran runtime error mkrems Programming 3 06-24-2008 03:42 PM
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM
Ambiguous Redirect Error AMMullan Linux - General 1 10-01-2003 08:39 PM
Ambiguous error messages from fsck, but not from e2fsck jiffydude Linux - Software 2 09-12-2003 06:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration