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

error linking library

clarantares
Beginner
607 Views
Hi, I'm trying to link a library to my fortran code in this way:

ifort main.f90 -o main -L/home/dirLib my_lib.a

I certainly know that my_lib.a is in that directory and there's no blank space between -L and the name of the directory but I receive this message

ld: my_lib.a: No such file: No such file or directory

Thanks
0 Kudos
2 Replies
TimP
Honored Contributor III
607 Views
This is a standard Unix/linux feature. -Lyourlibdir works with the special syntax -lyourlib, which searches for yourlibdir/libyourlib.a and libyourlib.so. In addition, linux ld doesn't handle non-standard variations in order of options. Details may be found in 'info ld'. If you don't want to use the -L syntax, you simply give the full path name of the library:
ifort -o main main.f90 /home/dirLib/my_lib.a
0 Kudos
clarantares
Beginner
607 Views
Thanks a lot, now it works ok
0 Kudos
Reply