Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Linking modules

adis1
Beginner
548 Views
Hi, I have some compiled modules in a directory /home/mods/ and a program main.f90 that uses that modules in directory /home/programs.
When I type in the directory /home/programs
ifort -c main.f90 -I/home/mods/
everything goes ok but afterwards, when I try to create the executable file with
ifort -o main main.o -I/home/mods
it gives me undefined references to the modules. How can I create my executable?

Thanks to all
0 Kudos
1 Reply
Steven_L_Intel1
Employee
548 Views
-I has no meaning when linking. You have to link against the .o files created when the modules were compiled. A common method is to insert the objects in a .a library and link to that.
0 Kudos
Reply