FloatingFeather
Programmer
I am using a subroutine in a code I have written, which used modules. Something weird happens when I compile the code with the module that corresponds to this subroutine. Actually, the whole subroutine is called as a module (it is an open access subroutine). The thing is that, in order to compile properly the whole module must be at the beginning of the code, otherwise I get the following error when attempting to compile with gfortran:
use gaussian
1
Fatal Error: Can't open module file ‘gaussian.mod’ for reading at (1): No such file or directory
compilation terminated.
However, if the module is at the beginning of the code it compiles ok. But it is impractical for coding, because I like to have my main code at the beginning of the file. However, once compiled, it doesn't matter if I move the whole module (subroutine) to the end, while I keep the compiled "gaussian.mod" file in the directory.
Is there a way to fix this problem? I mean, it is clear that I can keep the mod file, or even move the bunch of code that does that thing, but I would prefer something more elegant to do the job.
use gaussian
1
Fatal Error: Can't open module file ‘gaussian.mod’ for reading at (1): No such file or directory
compilation terminated.
However, if the module is at the beginning of the code it compiles ok. But it is impractical for coding, because I like to have my main code at the beginning of the file. However, once compiled, it doesn't matter if I move the whole module (subroutine) to the end, while I keep the compiled "gaussian.mod" file in the directory.
Is there a way to fix this problem? I mean, it is clear that I can keep the mod file, or even move the bunch of code that does that thing, but I would prefer something more elegant to do the job.