- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
my example program consist of three different parts. Each part is stored in his own file.
main.f:
program main
call sub
end
sub.f:
subroutine sub
use mod
write(*,*) 'logvar = ', logvar
end
mod.f:
module mod
logical :: logvar = .true.
end module mod
For mod.f I generate a static library as follows
ifort -fpic -c mod.f
ar rc modlib.a mod.o
After that I cleanup the temporary files with
rm mod.o mod.mod
Compiling and linking the entire program aborts withthe error
ifort main.f sub.f modlib.a
fortcom: Error: sub.f, line 2: Error in opening the Library module file. [MOD]
use mod
Please can someone explain to me, what is going wrong.
Thanks,
Dieter
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should not remove the .mod file. The .mod file does not go in the library but must be available to the compiler when you do a USE.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page