I am learning Fortran, and I'm stuck trying to compile a module for later use.
In the main program I have this, which asks for two numbers and then calls the function in the module:
use exponentiate
integer::a,b
write *, 'A'
read *, 'a
write *, 'B'
read *, 'b
write *,expo(a,b)
(I haven't tried that out because I need to compile the module first, but that's not the issue)
Then, on another file I have this code, which (If I understood anything correctly) is just a standard module with a function that exponentiates two numbers.
module exponentiate
interface test
module procedure expo
end interface
contains
function expo(a,b)
type(integer), intent(in)::a,b
type(integer) expo
integer::temp
temp=a
do i=1,b
temp=temp*a
end do
expo=temp
end function expo
end module exponentiate
I've been trying to figure the syntax out based on compiler errors since the Fortran 95 specification is unreadable and nearly useless. With that and some Wikipedia/SO help I've been able to figure some things out, but I have no idea why this compiler error pops up.
I'm not sure if this is because of some syntax issue or a misuse of gfortran, so any help would be appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…