| GNU Scientific Library Reference Manual - Revised Second Edition (v1.8) by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, M. Booth, F. Rossi Paperback (6"x9"), 636 pages, 60 figures ISBN 0954161734 RRP £24.99 ($39.99) |
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 -Lpath option can be omitted when GSL is
installed in its default location.
| ISBN 0954161734 | GNU Scientific Library Reference Manual - Revised Second Edition (v1.8) | See the print edition |