This is the mail archive of the gsl-discuss@sourceware.cygnus.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linking errors


I recommend that you wait for the next release. This will allow you to
link with a single -lgsl option.  

Because of interlibrary dependencies the order of the -l options in
version 0.5 was important. If you reverse the order of the -l options
you have below then it might work. Generally the lower level libraries
like -lgslerr need to go at the end.


J Andres Christen writes:
 > 
 > 
 > Hi,
 > 
 > I'm traying to use the vector and matrix functions of gsl_0.5 but I
 > can't link the example program:
 > 
 > #include <stdio.h>
 > #include <gsl_matrix.h>
 > 
 > int main ()
 > {
 >   int i, j; 
 >   gsl_matrix *m = gsl_matrix_alloc(10, 3);
 >   
 >   for (i = 0; i < 10; i++)
 >     for (j = 0; j < 3; j++)
 >       gsl_matrix_set (m, i, j, 0.23 + 100*i + j);
 >   
 >   for (i = 0; i < 100; i++)
 >     for (j = 0; j < 3; j++)
 >       printf("m(%d,%d) = %g\n", i, j, gsl_matrix_get (m, i, j));
 > }
 > 
 > with
 > 
 > gcc    -I/usr/local/include/gsl -L/usr/local/lib/gsl -O -o sim sim.o
 > -lgslsys -lgslerr -lgslieeeutils -lgsltest -lutils  -lgslblas
 > -lgslblascblas -lgslblasnative -lgsleigen -lgsllinalg -lgslrandist
 > -lgslrng -lgslspecfunc -lgslblock -lgslvector -lgslmatrix -lgsldht
 > -lgslfft -lgslhistogram -lgslintegration -lgslinterpolation -lgslmin
 > -lgslmonte -lgslmultiroots -lgslodeiv -lgslpoly -lgslroots -lgslsi
 > 
 > 
 > (I've included all the libraries.), I get error messages like:
 > 
 > /usr/local/lib/gsl/libgslmatrix.a(matrix.o): In function 
 > `gsl_matrix_char_set':
 > /usr/local/gsl-0.5/matrix/matrix_source.c:26: undefined reference to 
 > `gsl_check_range'
 > /usr/local/gsl-0.5/matrix/matrix_source.c:30: undefined reference to 
 > `gsl_error'/usr/local/gsl-0.5/matrix/matrix_source.c:34: undefined
 > reference to `gsl_error'
 > 
 > 
 > 
 > What am I doing wrong?
 > 
 > 
 > How could I know what libraries to use?  It is not clear to me from
 > reading the manual.
 > 
 > 
 > 
 > Thanks,
 > Andrés.
 > 
 > 
 > -- 
 > 
 > VERIFIQUE NUESTRA NUEVA DIRECCION, TELEFONOS Y CORREO-E.
 > PLEASE NOTE OUR NEW ADDRESS, PHONE NUMBERS AND E-MAIL.
 > 
 > Dr J Andrés Christen            Tel: 32-776 ext. (red-unam)
 > Instituto de Matematicas        Fax: 32-732 ext. (red-unam)
 > Campus Morelia, UNAM            Local DF: 562-32-776 o 32-732
 > AP 61-3 (Xangari)               Local Morelia: 320-05-65 (fax 66)
 > 58089, Morelia, Mich.           Otros: +52-562-32-776 o 32-732
 > MEXICO                          e-mail: jac@matmor.unam.mx
 > 
 > 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]