Problems with creating executables using GSL with RadHat Linux

Mihajlo mjovanov@ECECS.UC.EDU
Fri Apr 14 15:04:00 GMT 2000


Hello,

I wanted to try out GSL for some numerical equation solvers, but I am
running into problems generating an executable for even a simple example
code as given in
http://sourceware.cygnus.com/gsl/ref/gsl-ref_9.html#SEC88 .  The
installation seamed to have gone fine, the 'make check' script returned
almost all tests passed except for the last portion (attached is a copy
of the make_check.log file).  However when I try to build an example
executable I get into problems.  Executing

    gcc -I/usr/local/include/gsl -c main.c

 seams to go fine, but when I do

      gcc -lgslroots -L/usr/local/lib/gsl main.o

I get the following errors:

[root@ash CS690]# gcc -lgslroots -L/usr/local/lib/gsl main.o
main.o: In function `main':
main.o(.text+0xf0): undefined reference to `sqrt'
main.o(.text+0x148): undefined reference to `gsl_root_fsolver_brent'
main.o(.text+0x14e): undefined reference to `gsl_root_fsolver_alloc'
main.o(.text+0x15f): undefined reference to `gsl_root_fsolver_name'
main.o(.text+0x1ae): undefined reference to `gsl_root_fsolver_iterate'
main.o(.text+0x1bf): undefined reference to `gsl_root_fsolver_root'
main.o(.text+0x1d2): undefined reference to `gsl_root_fsolver_interval'
main.o(.text+0x1f8): undefined reference to `gsl_root_test_interval'
collect2: ld returned 1 exit status

,even though the library file libgslroots.a seams to be loaded.  I also
did a 'grep' for some of the listed references and they are indeed
present in the libgslroots.a file.

I am attaching all three example files that I am trying to compile.
What could be the problem?!

Thanks for your help.




More information about the Gsl-discuss mailing list