我有以下代码
module oc_tree
type star
integer :: id
real(8) :: v(3)=0, r(3)=0
end type
type node
real(8) :: corners(3,2)
type(node), dimension(:), pointer :: child_nodes
type(node), pointer :: father
type(star), allocatable :: stars_in(:)
real(8) :: tot_mass, center_mass(3)
integer :: id
end type node
contains
subroutine head_node(n2,m, stars, node1)
real(8), intent(IN) ::m
integer, intent(IN) :: n2
type(star), allocatable, dimension(:), intent(in) :: stars
real(8), parameter :: parsec = 3.085677581d16, d = 6661d3*parsec
integer :: i
type(node), intent(OUT) :: node1
procedure...
end subroutine head_node
recursive subroutine tree(m, node1)
type(node), intent(inout), target :: node1
integer :: i, n, j, last_id
real(8) :: c(3,2), r1(3)
type(node), pointer :: node
node => node1
call child_cubes(node)
procedure...
end subroutine tree
subroutine child_cubes(node)
type(node), intent(inout), target :: node
real(8) :: x_mid, y_mid, z_mid, c(3,2)
integer :: i
procedure
end subroutine child_cubes
end module oc_tree
由于某些原因,在子例程“child_cubes”中,编译器说
“/home/avner/Dropbox/final project/grav/main.f95 | 176 |错误:导出
类型“node”在定义之前正在使用
虽然在两个第一子程序中他没有问题。我不明白两个第一子程序和这个子程序的区别,知道吗?