Indeed, as @trojanfoe and @bergercookie said you have to compile your file and then link it to the library. As explained in compile and link, for that particular example:
First compile the file:
gcc -Wall -I/usr/local/include -c example.c -o example.o
second, link it to the library:
gcc -L/usr/local/lib example.o -lgsl -o example
where of course, /usr/local/lib should be replaced for the path where you have gsl installed.
The example
file is excutable.
EDIT: in macOS, from Yosemite the default location for the installation is /opt/local/lib (and /opt/local/include)
compile and link C/CPP programs on Mac
comments powered by Disqus