[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 2.0.0.18 (X11/20081119) |
Robin Hankin wrote:
Frank Reininghaus wrote:
Hi,
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?
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
address@hidden examples]$ more compile
#!/bin/sh
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=-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