help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Cannot get gsl_rng to work


From: Tommy Nordgren
Subject: Re: [Help-gsl] Cannot get gsl_rng to work
Date: Tue, 17 Jun 2008 13:21:13 +0200


On 16 jun 2008, at 04.53, Kevin Lansing wrote:

Hi,

I am new to using the GSL so I apologize in advance if there is a very easy
fix to my silly problem.

I am trying to run this code which I found on the GSL website, just to check
that I am able to use the functions.

    #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");
      gsl_rng_free (r);
      return 0;
    }

It gives me the following error: " error LNK2019: unresolved external symbol
_gsl_rng_default referenced in function _main ".

Have I not installed GSL properly? I've already tried out a few functions
such as creating a matrix and using Cholesky decomposition without any
problems. I am using VC++ Express 2005.

Thank you,
Kevin

The linear algebra functions, and the randon number functions are in different libraries.
You need to add the correct library when linking.
-----------------------------------

See the amazing new SF reel: Invasion of the man eating cucumbers from outer space. On congratulations for a fantastic parody, the producer replies : "What parody?"

Tommy Nordgren
address@hidden







reply via email to

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