user4372504
user4372504

Reputation:

Creating submodule in gfortran

This is code:

Program Submodules_0

Use Const_Var
Use Baz_Var

Implicit none

Call Pro_Baz

End Program Submodules_0

Module Const_Var

Implicit none

Integer::i
Integer,parameter::Br_NaNi=3
Real,parameter::S_baz=3.15E+06
Real,parameter,dimension(Br_NaNi)::V_baz=[110.0E+03,20.0E+03,0.40E+03]
Real,dimension(Br_NaNi)::I_baz,Z_baz,Y_baz

End module Const_Var

Module Baz_Var

Use Const_Var

Implicit none

Interface

Module subroutine Pro_Baz

End subroutine Pro_Baz

End interface

End module Baz_Var

Submodule(Baz_Var) Baz_Var_Main

Contains

Subroutine Pro_Baz

Implicit none

Do concurrent(i=1:Br_NaNi)

   I_baz(i)=(S_baz)/((sqrt(3.0))*V_baz(i))
   Z_baz(i)=(V_baz(i)**2)/(S_baz)
   Y_baz(i)=1/(Z_baz(i))

End Do

Return
End Subroutine Pro_Baz

End submodule Baz_Var_Main

I want to create submodules which contains subroutine Pro_Baz and when I start this program I got a this message:

Error: Unclassifiable statement

The message was on this line: Module subroutine Pro_Baz

What is wrong with this program?

Upvotes: 1

Views: 1004

Answers (1)

francescalus
francescalus

Reputation: 32366

Compiler support for submodules was introduced in gfortran in version 6.0.

Within an interface block, an interface body starting module subroutine ... is specific to the submodule facility. A complaint about an unclassifiable statement for this interface body is, then, an indication of a lack of submodule understanding. The compiler doesn't wait to complain on reaching a submodule statement.

The version of gcc/gfortran bundled with Code::Blocks 16.01 appears to be 4.9.2.

You will need to install, and configure the IDE to use, a more recent version of the compiler. This is whether you are using the Windows version with a bundled default compiler, or a version on any OS with a separate compiler installation.

Upvotes: 1

Related Questions