[R] R CMD SHLIB problem [make: *** No rule to make target ]

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 20 18:08:44 CEST 2007

Please do *not* use paths in your C code, especially those with spaces in. 
(The rw-FAQ did advise you not to install into a path with spaces in if 
you wanted to do development work.)  The path is not needed for system 
include files (you used <>) and is likely the problem.

And please do not post multiple times.

On Fri, 20 Jul 2007, Diogo Alagador wrote:

> Hy all,
> I apologize for my ingenuity in regard to interfaces in R, but I do need it for my work. In that respect I took a simple and small example from the net (the "hello world", one) to interface R with C.
> I have a Windows XP OS using R.2.5.0 and in that regard I have installed the Perl and RTools files to my PC. I also wrote a proper path file, as suggested.
> The C program is:
> #include <C:/Archivos de programa/R-2.5.0/include/R.h>
> void hello(int *n){
> int i;
> for(i=0;i<*n;i++){
> Rprintf("Hello, world!\n");
> }
> }

You don't need R.h, but you do need to declare Rprintf, which is in
<R_ext/Print.h>.  So a more legible version of a correct program would be

% cat holla.c

#include <R_ext/Print.h>

void hello(int *n)
     int i;
     for(i = 0; i < *n; i++)
          Rprintf("Hello, world!\n");

which you could call by

> dyn.load("holla.dll")
> .C("hello", 10L)

(note the L).

> However when trying to compile the a C file in the command window:
> R CMD SHLIB holla.c
> I get the following message:
> make: *** No rule to make target `holla.d', needed by `makeMakedeps'.  Stop.
> Can somebody give me a hand on this,
> Thanks in advance
> Diogo André Alagador
> 	[[alternative HTML version deleted]]

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list