necrohan 发表于 2021-8-12 08:12 好的,我试一试,谢谢!!!! |
li913 发表于 2021-8-11 17:33 感谢感谢!!! |
| 用参数传递返回值吧,比较简单 |
| 函数返回值为数组,需要interface. 看《interface功能详解》http://fcode.cn/guide-61-1.html |
|
我把外部函数定义改为: [Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode program main
implicit none
real,external::vvmat(2,2)
real dh0(2,2),v1(2)
integer n
n=2
dh0=vvmat(v1,v1,n)
end program main
function vvmat(a,b,n)
implicit none
integer n,i,j
real(kind=dp) a(n),b(n),vvmat(n,n)
do i=1,n
do j=1,n
vvmat(i,j)=a(i)*b(j)
end do
end do
end function vvmat出现了这样的错误: 错误 1 error #8099: The rank of the function reference does not match the rank of the function definition. [VVMAT] |
捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )
GMT+8, 2025-11-4 06:50