help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Help with random sampling


From: Frank Reininghaus
Subject: Re: [Help-gsl] Help with random sampling
Date: Thu, 27 Mar 2008 14:47:10 +0100

Hi Tim,

there are two problems in your code:

1. You have to add the lines

#include <stdio.h>
#include <gsl/gsl_randist.h>

to the beginning of your program. The header files "stdio.h" and
"gsl/gsl_randist.h" contain declarations of the functions you use (printf,
gsl_ran_choose). Without this information, the compiler complains about the
"implicit declaration", i.e., the appearance of a function without a proper
declaration. Additionally, you have to tell the linker where to find the
actual code of the functions. In order to do this, you have to add '-lgsl
-lgslcblas -lm' to the gcc command line, e.g.

gcc test.c -lgsl -lgslcblas -lm

2. The compiler issues a warning about your incorrect use of gsl_ran_choose.
Indeed, the first argument to this function should be of type gsl_rng *, not
int, see

http://www.gnu.org/software/gsl/manual/html_node/Shuffling-and-Sampling.html

Maybe you should read the chapter

http://www.gnu.org/software/gsl/manual/html_node/Using-the-library.html

in the manual and have a look at some example programs in the documentation
to get familiar with GSL programming.

Regards,
Frank


reply via email to

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