I am completely new to Linux. I've just installed Ubuntu 16.04 on an old PC and I am trying to install the gsl library for a project. I ran
sudo apt install libgsl2, libgsl0-dev, libgsl-dev, gsl-bin
Then I made a gsltest.c
test program with the code
#include <stdio.h>
#include <gsl_rng.h>
#include <gsl_randist.h>
int main (int argc, char *argv[])
{
/* set up GSL RNG */
gsl_rng *r = gsl_rng_alloc(gsl_rng_mt19937);
/* end of GSL setup */
int i,n;
double gauss,gamma;
n=atoi(argv[1]);
for (i=0;i<n;i++)
{
gauss=gsl_ran_gaussian(r,2.0);
gamma=gsl_ran_gamma(r,2.0,3.0);
printf("%2.4f %2.4f\n", gauss,gamma);
}
return(0);
}
I copied the code from somewhere on the internet and proceeded with the following command
gcc -Wall -I/home/myname/gsl/include -c gsltest.c
which throws an error:
gsltest.c:2:21: fatal error: gsl_rng.h: No such file or directory compilation terminated.
What am I doing wrong?
cc gsltest.c -o gsltest
work? I assume/usr/include/gsl/gsl_rng.h
is present, because you mention installing the relevant package. – Doug Smythies May 12 '17 at 21:17cc gsltest.c -o gsltest
did not work but when I checked in the GUI the file was present... – noobieboobie May 13 '17 at 07:58