[R] library file for R's nmath routines

Globe Trotter itsme_410 at yahoo.com
Fri Mar 3 02:01:28 CET 2006


Hi, 

Thanks!


--- Jos� Matos <jaomatos at gmail.com> wrote:

> I guess that you intended to send this message to the list. :-)
> 
> On 02/03/06, Globe Trotter <itsme_410 at yahoo.com> wrote:
> > Hi,
> >
> > Thanks, everyone for all the help! So, here is my calling function in C
> (called
> > test.c):
> >
> >
> >
> > #include<stdio.h>
> > #include<stdlib.h>
> > #include<Rmath.h>
> >
> >
> > int main(void) {
> >   printf("%f \n",pchisq(2.,7., 1, 0));
> >   printf("%f \n",pnchisq(2.,7.,0., 1, 0));
> >   return EXIT_SUCCESS;
> > }
> >
> >
> > I compile using:
> >
> >  gcc test.c -I/usr/lib/R/include -L/usr/lib/R/lib -lm -lR
> 
>   Why do you link against libm?
> 
>   Shouldn't it be
> gcc test.c -I/usr/lib/R/include -L/usr/lib/R/lib -lRmath -lR
> ?

I linked against libm because Rmath.h includes math.h so I thought that maybe
those links are needed.

But even linking this does not give the correct answer (for pchisq). Something
else is going on. 

I could not also get the runif to work.

Thanks!




More information about the R-help mailing list