[Top][All Lists]

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

[Help-gsl] GSL Installation problem

From: syed raza
Subject: [Help-gsl] GSL Installation problem
Date: Fri, 2 Oct 2009 11:25:03 +0500

Dar Sir/Madam
i have Mandriva Spring 2009 installated .  I want to compile a program of
simple Matrix  using  gcc  and GSL  .
i have the Mandriva Spring 2009 DVD . i dont have fast internet , so  i find
the gsl libriries on the DVD.
what i did is following:

$ cd /home ;mkdir gsl; cd gsl
$ tar --extract --file=gsl-1.9.tar.gz --gzip --verbose
$ ./configure --disable-static --enable-shared

i got these steps on internet . up to this point it worked .
$ make
didnot worked .

when i run  my matrixExp.c

 #include <stdio.h>

     #include <gsl/gsl_matrix.h>

     int    main (void)


       int i, j, k = 0;

       gsl_matrix * m = gsl_matrix_alloc (100, 100);

       gsl_matrix * a = gsl_matrix_alloc (100, 100);

              for (i = 0; i < 100; i++)

         for (j = 0; j < 100; j++)

           gsl_matrix_set (m, i, j, 0.23 + i + j);


          FILE * f = fopen ("test.dat", "wb");

          gsl_matrix_fwrite (f, m);

          fclose (f);   }


          FILE * f = fopen ("test.dat", "rb");

          gsl_matrix_fread (f, a);

          fclose (f);  }

            for (i = 0; i < 100; i++)

         for (j = 0; j < 100; j++)

           {             double mij = gsl_matrix_get (m, i, j);

             double aij = gsl_matrix_get (a, i, j);

             if (mij != aij) k++;           }

            gsl_matrix_free (m);

       gsl_matrix_free (a);

       printf ("differences = %d (should be zero)\n", k);

       return (k > 0);


 using the  command       gcc  matrixExp.c  -o matrixExp -lgsl

i got the following errors .

matrixExp.c:2:33: error: gsl/gsl_matrix.h: No such file or directory

matrixExp.c: In function ‘main’:

matrixExp.c:8: error: ‘gsl_matrix’ undeclared (first use in this function)

matrixExp.c:8: error: (Each undeclared identifier is reported only once

matrixExp.c:8: error: for each function it appears in.)

matrixExp.c:8: error: ‘m’ undeclared (first use in this function)
matrixExp.c:9: error: ‘a’ undeclared (first use in this function)

I also change the location of my  program  matixExp.c  to different
directris  like i placed it in gsl directory , but it didnot worked .
Plese help me compilting this program.

Regards  Shahid

reply via email to

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