[Top][All Lists]

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

[Help-gsl] example C file compile flags

From: Robin Hankin
Subject: [Help-gsl] example C file compile flags
Date: Fri, 09 Jan 2009 09:38:47 +0000
User-agent: Thunderbird (X11/20081209)


gsl-1.11, Suse 11.0.

I'm trying to compile the little example program for matrices
in section8.4.13, page95 of the manual.

But I can't figure out the correct flags:

address@hidden:~> cat f.c
#include <stdio.h>
#include <gsl/gsl_matrix.h>

    main (void)
      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++)  /* OUT OF RANGE ERROR */
        for (j = 0; j < 3; j++)
          printf ("m(%d,%d) = %g\n", i, j,
                  gsl_matrix_get (m, i, j));

      gsl_matrix_free (m);

      return 0;

address@hidden:~> gcc -I/usr/local/include f.c
/tmp/cc0jcO07.o: In function `main':
f.c:(.text+0x13): undefined reference to `gsl_matrix_alloc'
f.c:(.text+0x5d): undefined reference to `gsl_matrix_set'
f.c:(.text+0x98): undefined reference to `gsl_matrix_get'
f.c:(.text+0xca): undefined reference to `gsl_matrix_free'
collect2: ld returned 1 exit status

What are the correct flags here?

Robin K. S. Hankin
Uncertainty Analyst
University of Cambridge
19 Silver Street
Cambridge CB3 9EP

reply via email to

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