View previous topic :: View next topic |
Author |
Message |
hydro_rlh
Joined: 28 Sep 2024 Posts: 2
|
Posted: Sat Sep 28, 2024 5:47 pm Post subject: CONTAINS apparently not recognised |
|
|
I am trying to write a very simple program in the Plato IDE. However, despite the second Module having a CONTAINS statement, it refuses to compile because it has an executable line it it. Any suggestions?
Here is the code:
MODULE mDialog1
IMPLICIT NONE
PRIVATE; PUBLIC
INTEGER :: easting, northing, nrp, roofs, rb1
DOUBLE PRECISION :: roof_area, pitch
CHARACTER(len=256) :: buffer
INTEGER :: iw
END MODULE mDialog1
MODULE mDialog2
USE mDialog1
CONTAINS
IMPLICIT NONE
easting =456654
END MODULE mDialog2`
This generates the following message:
C:\Users\Robin\Documents\Testclearwin\FreeFormat1.F95(14) : error 853 - Executable statements are not allowed inside a MODULE (unless in CONTAINS)
I have tried changing the position of the CONTAINS statement and using fixed and free format. I was expecting it to compile properly. |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 713 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sat Sep 28, 2024 7:46 pm Post subject: |
|
|
An assignment such as easting =456654, must be within a subroutine or function that is within the contains section of the module.
Also IMPLICIT NONE must come immediately after any USE statements, and not be within the contains section.
You also need to specifically name the variables you wish to have the PUBLIC attribute. As it stands everything in the module mDialog1 is hidden. |
|
Back to top |
|
|
hydro_rlh
Joined: 28 Sep 2024 Posts: 2
|
Posted: Sun Sep 29, 2024 7:54 am Post subject: CONTAINS apparently not recognised |
|
|
Many thanks Kenneth_Smith for your help. As you probably realise this is the first time that I have tried to use MODULES and associated statements. |
|
Back to top |
|
|
|