如下简单的程序:
program ggg
implicit none
integer a,b,d
a=3
b=4
call plus1(a,b,d)
write(*,*),d
stop
end program ggg
subroutine plus1(a,b,c)
integer a,b,c
c=a+b
return
end subroutine plus1
如果subroutine命名为"plus1"可以编译成功,但如果是"plus"或者"sub1"这样的名字会提示编译错误:
The number of actual arguments cannot be greater than the number of dummy arguments.
请问这是什么原因?
代码没问题。如果你用的vsc+gfortran,它不会自动更新obj文件。你需要保存代码,重新编译。