Skip to main content

Thread: Gsl


hi everybody,

installed gsl library using sudo apt-get install libgsl0-dev.

use simple example
#include <stdio.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>

int
main (void)
{
const gsl_rng_type * t;
gsl_rng * r;

int i, n = 10;
double mu = 3.0;

/* create generator chosen
environment variable gsl_rng_type */

gsl_rng_env_setup();

t = gsl_rng_default;
r = gsl_rng_alloc (t);

/* print n random variates chosen
poisson distribution mean
parameter mu */

(i = 0; < n; i++)
{
unsigned int k = gsl_ran_poisson (r, mu);
printf (" %u", k);
}

printf ("\n");
gsl_rng_free (r);
return 0;
}
, using g++ -o exe_file -lgsl file.cpp
following errors
a.cpp.text+0x1e): undefined reference `gsl_rng_env_setup'
a.cpp.text+0x25): undefined reference `gsl_rng_default'
a.cpp.text+0x35): undefined reference `gsl_rng_alloc'
a.cpp.text+0x53): undefined reference `gsl_ran_poisson'
a.cpp.text+0x91): undefined reference `gsl_rng_free'
any appreciated.

by way using ubuntu 11.10.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Gsl


Ubuntu

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account