Compiler errors 如何使用'real sepa[allocatable](:)'语法编译Fortran?

Compiler errors 如何使用'real sepa[allocatable](:)'语法编译Fortran?,compiler-errors,compilation,fortran,gfortran,Compiler Errors,Compilation,Fortran,Gfortran,我正在尝试编译此程序/模块?Fortran语言中的(模.f) module vars_common real sepaa[allocatable](:) real sepan[allocatable](:) real rt[allocatable](:) real xob[allocatable](:) real npx[allocatable](:) real*

我正在尝试编译此程序/模块?Fortran语言中的(模.f)

      module vars_common
          real sepaa[allocatable](:)
          real sepan[allocatable](:)
          real rt[allocatable](:) 
          real xob[allocatable](:)
          real npx[allocatable](:)
          real*8 bb[allocatable](:)
          real*8 bl[allocatable](:)
          real*8 bu[allocatable](:)
          real*8 cvec[allocatable](:)
          real*8 ww[allocatable](:)
          real*8 a[allocatable](:,:)
          real*8 xi[allocatable](:)
          real*8 q[allocatable](:,:)
          real*8 dd[allocatable](:,:)
          !variables escalares
          integer maxm_var, maxn_var, nrowa_var
          integer liwork_var,lwork_var, maxbnd_var
      end module vars_common
      
*********************************************************************     
       subroutine allocate_data
          !maxm, maxn,maxbnd,mp
          use vars_common
          parameter(mg=1000, mp=2000)
          integer ind
          allocate(sepaa(0:maxm_var),sepan(0:maxm_var),rt(0:maxm_var),
     *    stat=ind)
          if (ind.ne.0) stop 'sin memoria'  
          allocate(xob(maxm_var),npx(0:mp), 
     *    stat=ind)
          if (ind.ne.0) stop 'sin memoria' 
          allocate(bb(0:maxm_var),bl(maxbnd_var),bu(maxbnd_var),
     *    stat=ind)
          if (ind.ne.0) stop 'sin memoria' 
          allocate(cvec(maxn_var), ww(maxn_var), 
     *    stat=ind)
          if (ind.ne.0) stop 'sin memoria' 
          allocate(a(0:maxm_var,0:maxn_var), stat=ind)
          if (ind.ne.0) stop 'sin memoria'
          allocate(xi(maxn_var),q(maxn_var,maxn_var),
     *    stat=ind)
          if (ind.ne.0) stop 'sin memoria'
          allocate(dd(maxn_var,maxn_var),stat=ind)
          if (ind.ne.0) stop 'sin memoria'
      end subroutine allocate_data
          
**********************************************************************
      subroutine deallocate_data
          use vars_common
          integer ind
          deallocate(sepaa,sepan,rt, stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio' 
          deallocate(xob,npx,stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio'
          deallocate(bb,bl,bu,stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio'
          deallocate(cvec,a,stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio'
          deallocate(xi,q,stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio'
          deallocate(dd,stat=ind)
          if (ind.ne.0) stop 'problema liberando espacio'
      end subroutine deallocate_data
***********************************************************************
我不知道Fortran的版本是什么,但我在Ubuntu20.04.1LTS的终端中尝试了以下命令

gfortran modulos.f我收到了以下错误消息: >模f:2:21:

    2 |           real sepaa[allocatable](:)
      |                     1
Fatal Error: Coarrays disabled at (1), use ‘-fcoarray=’ to enable
compilation terminated.
gfortran-fcoarray=lib-c模.fgfortran-fcoarray=single-c模.f 我收到了以下错误消息:

modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading at (1): No such file or directory
compilation terminated.
gfortran -fcoarray=none -c modulos.f 
modulos.f:2:21:

    2 |           real sepaa[allocatable](:)
      |                     1
Fatal Error: Coarrays disabled at (1), use ‘-fcoarray=’ to enable
compilation terminated.
gfortran -fcoarray=single -c modulos.f
modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading 

at (1): No such file or directory
    compilation terminated.
gfortran-fcoarray=none-c modulos.f我收到了以下错误消息:

modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading at (1): No such file or directory
compilation terminated.
gfortran -fcoarray=none -c modulos.f 
modulos.f:2:21:

    2 |           real sepaa[allocatable](:)
      |                     1
Fatal Error: Coarrays disabled at (1), use ‘-fcoarray=’ to enable
compilation terminated.
gfortran -fcoarray=single -c modulos.f
modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading 

at (1): No such file or directory
    compilation terminated.
gfortran-fcoarray=single-c modulos.f我收到了以下错误消息:

modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading at (1): No such file or directory
compilation terminated.
gfortran -fcoarray=none -c modulos.f 
modulos.f:2:21:

    2 |           real sepaa[allocatable](:)
      |                     1
Fatal Error: Coarrays disabled at (1), use ‘-fcoarray=’ to enable
compilation terminated.
gfortran -fcoarray=single -c modulos.f
modulos.f:2:33:

    2 |           real sepaa[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:3:33:

    3 |           real sepan[allocatable](:)
      |                                 1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:4:30:

    4 |           real rt[allocatable](:)
      |                              1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:5:31:

    5 |           real xob[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:6:31:

    6 |           real npx[allocatable](:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:7:32:

    7 |           real*8 bb[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:8:32:

    8 |           real*8 bl[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:9:32:

    9 |           real*8 bu[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:10:34:

   10 |           real*8 cvec[allocatable](:)
      |                                  1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:11:32:

   11 |           real*8 ww[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:12:31:

   12 |           real*8 a[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:13:32:

   13 |           real*8 xi[allocatable](:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:14:31:

   14 |           real*8 q[allocatable](:,:)
      |                               1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:15:32:

   15 |           real*8 dd[allocatable](:,:)
      |                                1
Error: Upper bound of last coarray dimension must be ‘*’ at (1)
modulos.f:24:13:

   24 |           use vars_common
      |             1
Fatal Error: Cannot open module file ‘vars_common.mod’ for reading 

at (1): No such file or directory
    compilation terminated.

你能帮我找到解决办法吗?最好使用gfortran作为编译器。谢谢

[可分配]
不是标准Fortran

而不是

      real sepaa[allocatable](:)
      real sepan[allocatable](:)
Fortran需要

      real, allocatable :: sepaa(:)
      real, allocatable :: sepan(:)
等等。还存在具有
维度
属性或单独的
可分配
语句的备选方案

如果不是在太多的地方,我建议手动进行此更正

您可以尝试询问您的主管它是什么样的语法,以及应该如何编译它。他们可能不知道从哪里学来的,但至少他们可能知道他们使用的编译器。但我建议,如果搜索并购买一些将其作为扩展接受的编译器,则应修改代码


gfortran告诉您的是,标准Fortran使用方括号表示。这些用于并行处理

real, allocatable :: A(:)[:]

我认为这与您的代码无关。

请不要将相关代码放在某些Google drive链接上。在此处复制并粘贴相关代码。见和。
[allocatable]
看起来不像标准Fortran。代码应该使用coarray吗?“类似错误”到底是什么?我想他们毕竟是完全不同的。是你的代码还是别人的代码?它是为某人编译的吗?对不起。我编辑了我的问题,并将代码粘贴在那里。此外,我还包含了其他错误消息。这是我的博士开发的更大项目的一部分。2003年担任主管。它没有很好的记录/评论,所以我的任务是尽可能多地理解,然后我必须用它作为参考来构建新事物……谢谢你,@Vladimir F。我会听从你的建议。我会带着结果回来的。我能够按照你的建议编译程序@Vladimir F谢谢!