PDA

View Full Version : help on using a library



hadjimurad
August 26th, 2011, 03:54 AM
I have a sparse matrix library libskit.a that I'm trying to use. When I compile with

gfortran -lskit test.o -o test.out

all of the calls to subroutines defined in the library give undefined references. However, when I instead use

gfortran libskit.a test.o -o test.out

then everything works fine. I have the .a file copied into /usr/lib and /usr/local/lib already; using other libraries like BLAS with the -l flag works just fine. Any ideas?

Bachstelze
August 26th, 2011, 04:06 AM
-l flags go at the end of the command line. This should work:


gfortran -o test.out test.o -lskit

hadjimurad
August 27th, 2011, 08:56 PM
Thanks, that worked. Man is that a silly mistake.