[R] question about /nmath/standalone

xt_wang@cs.concordia.ca xt_wang at cs.concordia.ca
Wed Apr 14 19:20:05 CEST 2004


I can't link a c code with Mathlib according to introduction of R 
manual "Writing R Extensions", page 60.

It is written :
"It is possible to build Mathlib, the R set of mathematical functions 
documented in
'Rmath.h’, as a standalone library 'libRmath’ under Unix and Windows. (This 
the functions documented in Section 5.7 [Numerical analysis subroutines], page 
61 as fromthat header file.)

The library is not built automatically when R is installed, but can be built 
in the
directory 'src/nmath/standalone’ in the R sources: see the file 'README’ 
there. To use thecode in your own C program include

#include <Rmath.h>

and link against '-lRmath’. There is an example file 'test.c’."

Have I to do: gcc -lRmath test.c ? In this case I receive this message: 

> /usr/bin/ld: cannot find -lRmath 
> collect2: ld returned 1 exit status "

what should I do? or I do something before I use "gcc -lRmath test.c" to 
compile c code test.c?

I will appreciate if you can help me resolve this problem.


Maggie Wang

More information about the R-help mailing list