【问题标题】:Unclassifiable statement at (1) in gfortran linuxgfortran linux中(1)处的不可分类声明
【发布时间】:2020-03-10 01:40:11
【问题描述】:

我是 Linux(Ubuntu) 中的初级 Fortran 程序员。我有一个在 Windows 中使用 Intel Visual Fortran 运行的代码,但是当我尝试在 Linux 上使用 gfortran 编译此代码时出现此错误:

Error: Unclassifiable statement at (1)

我的代码是:

    module mesh
     type::meshreader
      private
      integer::NF
      integer::y
      contains
      procedure , public :: getNF
      end type
      contains
      function getNF(this)    
      class(meshreader) :: this
       integer :: getNF
        getNF = this.NF
        end function
        end module

     Implicit None

      print*, 'Hello'
        End 

我认为gfortran不能知道这行代码:getNF = this.NF。 谁能帮我解决这个问题?

【问题讨论】:

  • Fortran 以这种方式拼写已经 30 多年了。请了解如何使缩进保持一致。

标签: linux oop fortran gfortran fortran90


【解决方案1】:

Fortran 中的结构组件不是使用点选择的,而是使用% (this%NF)。

点符号仅由某些编译器作为扩展提供,但它是高度非标准的。我建议避免它。

% 字符是干什么用的,总结在What does "%" mean / do in Fortran?

【讨论】:

  • tnx 为您提供帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多