0
votes

I am elementary Fortran programmer in Linux(Ubuntu). I have a code that run with Intel Visual Fortran in Windows but when I try to compile this code with gfortran on Linux I get this error:

Error: Unclassifiable statement at (1)

My code is :

    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 

I think gfortran can not know this line of code: getNF = this.NF. Can anyone help me to solve this problem?

1
Fortran has benn spelled this way for more thsn 30 years. Please learn how to get your indentation consistent. - Vladimir F

1 Answers

3
votes

Structure components in Fortran are not selected using a dot but using % (this%NF).

The dot notation is only offered by some compilers as an extension, but it is highly non-standard. I suggest avoiding it.

What is the % character used for is summarized in What does "%" mean / do in Fortran?