Robin Hankin wrote:
Frank Reininghaus wrote:
Hi,

2009/1/9 Robin Hankin <[email protected] <mailto:[email protected]>>

    rk...@linux-7okp:~> gcc -I/usr/local/include f.c

    What are the correct flags here?


try

gcc f.c -lgsl -lgslcblas -lm


Thanks Frank, it works!

Now, could we add that piece of wisdom to the manual *just where it's needed*? The

Robin,

I'm also new to GSL.  I think you are selling the GSL manual short:

http://www.gnu.org/software/gsl/manual/html_node/Compiling-and-Linking.html
http://www.gnu.org/software/gsl/manual/html_node/Linking-programs-with-the-library.html
http://www.gnu.org/software/gsl/manual/html_node/Linking-with-an-alternative-BLAS-library.html

... I think you will want to ensure that you understand the rammifications of '-lgslcblas'...

You may possibly also find the below helpful (these flags work for for me on Fedora 9, YMMV). The first is a simple shell script and the second is the Makefile from the below helpful, but now somewhat out of date, page from Darren Wilkenson. (Wilkenson's page has a more detailed example regarding matrices and if that's of interest, I have modified it to compile with recent versions of GSL.)
http://www.mas.ncl.ac.uk/~ndjw1/teaching/sim/gsl.html

-Alan

[am...@cow2 examples]$ more compile
#!/bin/sh
echo Attempting to compile $1.c into executable $1...
gcc -Wall -Wextra -lgsl -lgslcblas $1.c -o $1

[am...@cow2 examples]$ more Makefile
# Makefile for building C stuff with GSL

#CFLAGS=-I/usr/include/gsl
CFLAGS=-Wall -Wextra -g -ansi -pedantic
LDFLAGS=-lgsl -lgslcblas
CC=gcc

%: %.c
   $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@

# eg. do "make gsl_test" to make gsl_test from gsl_test.c
# then run with "gsl_test 10"

clean:
   rm -f *~ *.o core a.out


--
Alan D. Mead, Ph.D. Assistant Professor, Institute of Psychology
Scientific Adviser, Center for Research and Service
Illinois Institute of Technology
3101 South Dearborn, 2nd floor
Chicago IL 60616

Skype: alandmead
+312.567.5933 (Campus)
+815.588.3846 (Home Office)
+312.567.3493 (Fax)

http://www.iit.edu/~mead
http://www.center.iit.edu
http://www.alanmead.org

Be not afraid of life. Believe that life is worth living, and your belief will 
help create the fact.
-- Henry James



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to