- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am consolidating parameter duplication in our code and have defined a parameter SDENW now in one module only, say module A. However this variable exists in module B too (not just as a parameter definition, which I have removed, but also on the right hand side of other parameter definitions).
To prevent duplication, I tried to let Module B USE module A. However the link fails as the compiler compiles file B.F90 before A.F90 and therefore cannot find A.MOD. Of course I could just link twice, but I don't want to do that. Is there a better way to do this?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adrian F. wrote:
To prevent duplication, I tried to let Module B USE module A. However the link fails as the compiler compiles file B.F90 before A.F90 and therefore cannot find A.MOD. Of course I could just link twice, but I don't want to do that. Is there a better way to do this?
The link step fails because one of the .OBJ files it needs is not present. That situation, in turn, is caused by the compiler's not finding a .MOD file that it needed in compiling B.F90.
Linking twice will not solve the problem, because the problem is a compile-time problem.
The basic rule to remember is that before the compiler encounters the program unit containing the USE statement the corresponding .MOD file should have been created . How to go about enforcing the compilation order depends on whether you are using a makefile or the IDE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:
The link step fails because one of the .OBJ files it needs is not present. That situation, in turn, is caused by the compiler's not finding a .MOD file that it needed in compiling B.F90.
Linking twice will not solve the problem, because the problem is a compile-time problem.
The basic rule to remember is that before the compiler encounters the program unit containing the USE statement the corresponding .MOD file should have been created . How to go about enforcing the compilation order depends on whether you are using a makefile or the IDE.
I am using Visual Studio 2010 with Intel Fortran Composer 13.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adrian F. wrote:
..
I am using Visual Studio 2010 with Intel Fortran Composer 13.
So if you're using Visual Studio, then most of the module dependency stuff is automatically taken care of assuming you've configured your solution properly. Have you looked at the Help Viewer in Visual Studio and reviewed Intel's Fortran guide and examples to make sure you're configuration is proper?
Otherwise, you will need to provide your Visual Studio configuration details, preferably a zip of your solution (sln file) and Fortran project(s) (vfproj file(s)) so someone can look and guide you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FortranFan wrote:
So if you're using Visual Studio, then most of the module dependency stuff is automatically taken care of assuming you've configured your solution properly. Have you looked at the Help Viewer in Visual Studio and reviewed Intel's Fortran guide and examples to make sure you're configuration is proper?
Otherwise, you will need to provide your Visual Studio configuration details, preferably a zip of your solution (sln file) and Fortran project(s) (vfproj file(s)) so someone can look and guide you.
No problem, it works fine... I had misspelt the module name in the USE statement! sorry. It builds correctly. Thanks.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page