Go to the first, previous, next, last section, table of contents.

Compiling and Linking

The library header files are installed in their own `gsl' directory. You should write any preprocessor include statements with a `gsl/' directory prefix thus,

#include <gsl/gsl_math.h>

If the directory is not installed on the standard search path of your compiler you will also need to provide its location to the preprocessor as a command line flag. The default location of the `gsl' directory is `/usr/local/include/gsl'.

The library is installed as a single file, `libgsl.a'. A shared version of the library is also installed on systems that support shared libraries. The default location of these files is `/usr/local/lib'. 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 app.o -lgsl -lgslcblas -lm

The following command line shows how you would link the same application with an alternative blas library called `libcblas',

gcc app.o -lgsl -lcblas -lm

For the best performance an optimized platform-specific CBLAS library should be used for -lcblas. The library must conform to the CBLAS standard. The ATLAS package provides a portable high-performance BLAS library with a CBLAS interface. It is free software and should be installed for any work requiring fast vector and matrix operations. The following command line will link with the ATLAS library and its CBLAS interface,

gcc app.o -lgsl -lcblas -latlas -lm

For more information see section BLAS Support.

The program gsl-config provides information on the local version of the library. For example, the following command shows that the library has been installed under the directory `/usr/local',

bash$ gsl-config --prefix
/usr/local

Further information is available using the command gsl-config --help.


Go to the first, previous, next, last section, table of contents.