我正在以此方式进行编译,请问顺序是什么关系?
$ gfortran -o xout lu.f90 chebys.f90 main.f90
/tmp/cc57W83g.o: In function `__chebys_MOD_ddcheby':
chebys.f90:(.text+0x149): undefined reference to `dcheby_'
/tmp/cc57W83g.o: In function `__chebys_MOD_dcheby':
chebys.f90:(.text+0x24d): undefined reference to `cheby_'
collect2: error: ld returned 1 exit status
但是我不明白我在做什么错。 我的模块仅包含功能
module chebys
CONTAINS
Real (kind=8) FUNCTION cheby(m,r)
implicit none
integer j,m
real(kind=8) r
real(kind=8) cheby0,cheby1,chebyn
cheby0 = 1.0d0
cheby1 = r
if(m.eq.0) then
cheby = cheby0
else if(m.eq.1) then
cheby = cheby1
else if(m.ge.2) then
do j=2,m
chebyn = 2.0d0*r*cheby1 - cheby0
cheby0 = cheby1
cheby1 = chebyn
end do
cheby = chebyn
end if
end FUNCTION cheby
Real (kind=8) FUNCTION dcheby(m,r)
implicit none
.
.
.
end FUNCTION dcheby
Real (kind=8) FUNCTION ddcheby(m,r)
implicit none
.
.
.
end FUNCTION ddcheby
end module chebys
我应该声明reals变量cheby, dcheby,ddcheby,exact,f在主程序中?我没做