1 (edited by JohnWasilewski 2012-02-18 16:25:01)

Topic: Inserting new modules in project structure

I have encountered a slight (repeat, slight) difficulty in 'inserting' a new MODULE into an existing large-ish project. 

I say, 'inserting', rather than 'adding' because I don't mean just adding new data and code as part of the development process as a project grows.  I mean when I take an existing project that has been re-compiled many times, and already has many object code and .mod files stored in the project directory, but needs a bit of a clean-up.  The problem arises when altering the data structure by removing numerous type declarations and INCLUDE statements from various source files in the project structure then 'inserting' a new module in the project and 'inserting' new USE statements wherever they are needed in the source files.

The problem has shown itself after coding, saving and adding the new MODULE to the project, and when inserting USE statements in the source files that need the declarations in the module.  Two malfunctions ocurred.

One was that the new module seemed not to have been accepted by the project.  I say this because the text in the module remained as plain black type, with none of the colour-coding used by the editor to signify its recognition of a Fortran source file.  The other problem was that new USE statements inserted in the other source files immediately triggered a red-background error message in the source file, of "..can't open module filefor reading: no such file or directory."

I tried doing a project re-BUILD.  I tried re-saving the project and re-BUILDing.  I tried exiting from Simply Fortran and re-starting.  None of these would make the program colour-in the MODULE source file and remove the "can't open module" error.

I then checked various things.  I found that,
- The new MODULE was listed in the project tree
- The BUILD STATUS showed that it had been compiled.
- The MODULES subdirectory did contain a .mod file for it.

I also tried CLEANing the project and re-BUILDing.  I also tried changing the name of the new module in case of some hidden naming conflict with Win Doze (I had called it 'WINSTUFF' and the source file was 'WINSTUFF.FOR').  Changing the module name took quite a while because I had to go through many source files and edit the USE statements.

Whilst I was doing everything in my previous paragraph, it all came back to life.  The module is now fine and all the USE statements work.  I have subsequently changed the module name back to 'WINSTUFF' and reBUILT without error, so that seems not to have been the problem.  Unfortunately I do not know exactly which of my actions did cure it.  It is possible that, if I had waited long enough when the problem first appeared, it would have melted away on its own (after SF had had tiem to complete all its project-wide syntax checks), but I suspect not because cleaning, exiting and re-starting etc would surely have fixed it also.

This is therefore an incomplete report but it's the best I can do.  If I learn more I'll add to it.  As I said at the start, it is not a big issue.
---
John

Re: Inserting new modules in project structure

John,

Thanks for the report.  Modules can be tricky as they introduce a build order dependency into Fortran.  If Simply Fortran hasn't yet gotten around to syntax-checking the file containing a new module, it can sometimes cause USE statements to appear as errors.  A Clean and Build cycle often cures this as long as the option to automatically regenerate the makefile (in Project Options) is enabled.  Additionally, you sometimes may need to press the refresh button on Syntax Warning and Errors panel.

I have had rare instances myself where an error persisted within the IDE, but the project, when built, compiled fine.  I do need to look into the issue a bit more.

Jeff Armstrong
Approximatrix, LLC