The best way to get the correct arguments to link the GSL library is with the pkg-config command:
Code:
$ pkg-config --libs gsl
That will print the options required to link the GSL library. You can also use the --cflags option to get the correct compiler options:
Code:
$ pkg-config --cflags gsl
(That may just print a blank line, meaning no special options are required, since the header files are in a standard directory.)
To compile and link a program that is contained in a single C file that uses GSL:
Code:
$ gcc myprogram.c `pkg-config --cflags --libs gsl` -o myprogram
Or, to compile and then link,
Code:
$ gcc -c myprogram.c `pkg-config --cflags gsl`
$ gcc myprogram.o `pkg-config --libs gsl` -o myprogram
I don't use KDevelop or Anjuta, but I am sure there is a standard way to tell them to use the required compiler options.
Bookmarks