[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] example C file compile flags

From: Alan Mead
Subject: Re: [Help-gsl] example C file compile flags
Date: Fri, 09 Jan 2009 07:19:36 -0600
User-agent: Thunderbird (X11/20081119)

Robin Hankin wrote:
Frank Reininghaus wrote:

2009/1/9 Robin Hankin <address@hidden <mailto:address@hidden>>

    address@hidden:~> gcc -I/usr/local/include f.c

    What are the correct flags here?


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


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

... 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.)


address@hidden examples]$ more compile
echo Attempting to compile $1.c into executable $1...
gcc -Wall -Wextra -lgsl -lgslcblas $1.c -o $1

address@hidden examples]$ more Makefile
# Makefile for building C stuff with GSL

CFLAGS=-Wall -Wextra -g -ansi -pedantic
LDFLAGS=-lgsl -lgslcblas

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

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

   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)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]