Next: , Previous: An Example Program, Up: Using the library   [Index]


2.2 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. A typical compilation command for a source file example.c with the GNU C compiler gcc is,

$ gcc -Wall -I/usr/local/include -c example.c

This results in an object file example.o. The default include path for gcc searches /usr/local/include automatically so the -I option can actually be omitted when GSL is installed in its default location.