Silverfrost Forums

Welcome to our forums

CONTAINS apparently not recognised

28 Sep 2024 4:47 #31578

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.

28 Sep 2024 6:46 #31579

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.

29 Sep 2024 6:54 #31580

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.

Please login to reply.