【问题标题】:"Error Unclassifiable statement" on Linux [duplicate]Linux上的“错误不可分类声明”[重复]
【发布时间】:2016-03-27 10:47:16
【问题描述】:

在我的 Linux 集群中使用 gfortran 编译 .for 格式文件。

通过输入 gfortran -O2 calpuff.for -o calpuff.exe,发生了一个错误

无法分类的陈述

错误
 In file calutils.for:2912
 Included at calpuff.for:2115
   cdeflt=ctext      
 Error: Unclassifiable statement at (1)   

相应的 calutil.for 显示如下:

c ----------------------------------------
c
      character*132 ctext,cdeflt
c
c --- Microsoft variables
c *** integer*2 iarg,istat
c
c --- HP declaration
c *** external getarg
c *** external iargc
c
c --- The following is for any system without a command line routine
c --- and is also used as a default
       cdeflt=ctext   ## Line 2912
c
c ---------------------------------------- 
c ----------------
## Another subroutine.
c --- Sun compiler
c ----------------
     numargs=IARGC()
     if(numargs.ge.1)then
     call GETARG(1,ctext)
     endif   



### Add another subroutine which are the only code related to `cdeflt`
c --- If no command line arguments, use default
  if(ctext(1:1).eq.' ')ctext=cdeflt   # Line 2954

  return
  end

更新

感谢@Alexander Vogt 的提醒,下面的代码是 calpuff.for

c----------------------------------------------------------------------
c --- BRING IN SUBROUTINES for MCHEM=6,7 OPTIONS (API)
      include 'api_chem.for'
      include 'isorropia.for'
c --- BRING IN CALPUFF SYSTEM UTILITY SUBROUTINES
      include 'calutils.for'   ### This is line 2115
      include 'coordlib.for'
c----------------------------------------------------------------------

cdeflt=ctext 有什么问题?谁能给点建议?

【问题讨论】:

  • 好的。我马上上传!
  • 感谢您的耐心等待。我在calutil.for 的第 2912 行之后添加了更多代码。更重要的是,我将整个文件上传到Code
  • 更多背景故事:代码文件可以编译成calpuff.exe用于空气质量建模。我曾尝试修改calutil.for 中的一些子例程以更改编译器。原来是Lahel compiler 用于Windows。我想改成gfortran

标签: linux compiler-errors fortran gfortran


【解决方案1】:

实际错误发生在后面的行中:

c ----------------
c --- Sun compiler
c ----------------
     numargs=IARGC()
     if(numargs.ge.1)then
     call GETARG(1,ctext)
     endif

你只有五个空格,(至少)六个是必需的。它应该是

c ----------------
c --- Sun compiler
c ----------------
      numargs=IARGC()
      if(numargs.ge.1)then
        call GETARG(1,ctext)
      endif

在固定形式的 Fortran 中,前六列有特殊含义,不能用于代码。

不幸的是,这(再次)使您​​的问题与 SO 上的许多其他问题重复。

【讨论】:

  • 感谢您的耐心等待。在这个错误发生之前我已经解决了这个问题(忘记更改谷歌文档)。那个时候,我有 5 个错误
  • 那么请显示当前版本。
  • 谢谢!我上传了here
  • 我没有谷歌账户,也不会得到。
  • 请把它放到一个新问题中,这个问题与这个问题无关。
猜你喜欢
  • 2020-03-10
  • 1970-01-01
  • 2013-02-25
  • 2014-01-13
  • 2015-07-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多