I was wondering if anyone on the forum was using R?
I am compiling c codes for use in R, but for some wierd reason they wont compile if I include a header file.
lets says I have the following saved as test.c
#include < R.h >
/* including the header R.h */
#include < stdio.h >
/*must be void as the function should not return anything*/
void twoloop(int *startOne, int *stopOne, int *stepOne, int *startTwo, int *stopTwo, int *stepTwo)
{
int i,j;
for(i = *startOne; i < *stopOne+1; i = i + *stepOne)
for(j = *startTwo; j < *stopTwo+1; j = j + *stepTwo)
Rprintf("Parameter one is %d and Parameter two is %d\n", i, j);
}
Then when I want to build shared library for dynamic loading using "R CMD SHLIB test.c", I get this:
gcc -std=gnu99 -I/usr/lib/R/include -I/usr/local/include -fpic -O2 -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables -c twoloops.c -o twoloops.o
twoloops.c:1:17: fatal error: R.h : No such file or directory
compilation terminated.
make: *** [twoloops.o] Error 1
The file however exists, I can confirm that. Whats Up? Does anyone know what I am missing?