[R] R mathlib

Timur Elzhov Timur.Elzhov at jinr.ru
Tue Jun 22 15:41:53 CEST 2004


Hello, dear R experts!

I run R on Debian 'sarge' platform. There is 'r-mathlib' package in
Debian distribution, which is described as:
   $ dpkg --status r-mathlib
   ...
   This packages provides the libRmath shared and static libraries which
   can be called from standalone C or C++ code.

Well, I use runif() function in test_runif.c:

#include <Rmath.h>

main()
{
// ...
    printf("%f\n", runif(0, 1));
}

and compile it:

$ gcc -I/usr/lib/R/include -lRmath -lm -o test_runif test_runif.c 
 /tmp/ccmICWeD.o(.text+0x2d): In function `main':
 : undefined reference to `Rf_runif'
 collect2: ld returned 1 exit status

Replacing `-lm' with `-lR' solves the problem. So, I need libR.so anyway?

Thanks.

--
WBR,
Timur




More information about the R-help mailing list