[R] replicating C example from the Extensions Manual problem

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Mar 15 07:56:05 CET 2012

Do you really expect is to know how to figure out the error if you don't give us the code that the error is pointing at (or the code preceding the error, which may be at fault)? Please think before posting.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

Erin Hodgess <erinm.hodgess at gmail.com> wrote:

>Dear R People:
>Here is something that I am sure is very simple.  I'm just trying to
>re-create the C convolution example in the Extensions manual.  Here is
>the subroutine:
>void convolve(double *a, int *na, double *b, int *nb, double *ab)
>R_len_t i, j, nab = *na + *nb - 1;
>for(i = 0; i < nab; i++)
>ab[i] = 0.0;
>for(i = 0; i < *na; i++)
>for(j = 0; j < *nb; j++)
>ab[i + j] += a[i] * b[j];
>And here are the results from trying to compile:
>erin at ubuntu:~$ R CMD SHLIB convolve.c
>gcc -std=gnu99 -I/usr/share/R/include      -fpic  -O3 -pipe  -g -c
>convolve.c -o convolve.o
>convolve.c: In function ‘convolve’:
>convolve.c:3:1: error: unknown type name ‘R_len_t’
>make: *** [convolve.o] Error 1
>What is wrong, please?
>This is on Ubuntu 11.10 with R-2.14.2.  I'm sure that it's totally
>Erin Hodgess
>Associate Professor
>Department of Computer and Mathematical Sciences
>University of Houston - Downtown
>mailto: erinm.hodgess at gmail.com
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list