This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
A problem compiling and linking gsl
- From: <cgarnica at 007mundo dot com>
- To: <gsl-discuss at sources dot redhat dot com>
- Date: Tue, 22 Oct 2002 09:19:44 -0500
- Subject: A problem compiling and linking gsl
Hi!
I've just downloaded gsl and I've installed the libs, bins, includes, etc. When I tried to test a program the following message pops up (this was using the random distribution library, but it happens with all libraries):
C:\WINDOWS\TEMP\ccw9aaaa.o(.text+0x2c):testal~1.cpp: undefined reference to `gsl_rng_env_setup'
C:\WINDOWS\TEMP\ccw9aaaa.o(.text+0x31):testal~1.cpp: undefined reference to `gsl_rng_default'
C:\WINDOWS\TEMP\ccw9aaaa.o(.text+0x40):testal~1.cpp: undefined reference to `gsl_rng_alloc'
C:\WINDOWS\TEMP\ccw9aaaa.o(.text+0x71):testal~1.cpp: undefined reference to `gsl_ran_poisson'
I don't know why it displays something about C:\WINDOWS\TEMP\ and why does it say "undefined reference".
I'm using Dev-C++ 4.
By the way, below is the code of the test program:
Thanks for help,
Carlos Andrés Garnica
#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 a generator chosen by the
environment variable GSL_RNG_TYPE */
gsl_rng_env_setup();
T = gsl_rng_default;
r = gsl_rng_alloc (T);
/* print n random variates chosen from
the poisson distribution with mean
parameter mu */
for (i = 0; i < n; i++)
{
unsigned int k = gsl_ran_poisson (r, mu);
printf(" %u", k);
}
printf("\n");
return 0;
}