- publishing free software manuals
GNU Scientific Library Reference Manual - Third Edition (v1.12)
by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi
Paperback (6"x9"), 592 pages, 60 figures
ISBN 0954612078
RRP £24.95 ($39.95)

Get a printed copy>>>

2.2.1 Linking programs with the library

The library is installed as a single file, ‘libgsl.a’. A shared version of the library ‘libgsl.so’ is also installed on systems that support shared libraries. The default location of these files is ‘/usr/local/lib’. If this directory is not on the standard search path of your linker you will also need to provide its location as a command line flag.

To link against the library you need to specify both the main library and a supporting cblas library, which provides standard basic linear algebra subroutines. A suitable cblas implementation is provided in the library ‘libgslcblas.a’ if your system does not provide one. The following example shows how to link an application with the library,

$ gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm

The default library path for gcc searches ‘/usr/local/lib’ automatically so the -L option can be omitted when GSL is installed in its default location.

ISBN 0954612078GNU Scientific Library Reference Manual - Third Edition (v1.12)See the print edition