[Rcpp-devel] Request for help with compiling Rcpp example

Dirk Eddelbuettel edd at debian.org
Thu Oct 13 16:24:56 CEST 2011


Hi,

And thanks for posting here.

On 13 October 2011 at 16:16, Slava Razbash wrote:
| I am trying to compile the example program with "inline" from the
| jstatsoft article by Eddelbuettel and Francois (2011). I am using
| WinXP and R 2.13.2 and RCPP 0.9.7. I am using Rtools 2.14.
| 
| My code:
|  src <- '
|   Rcpp::NumericVector xa(a);
|   Rcpp::NumericVector xb(b);
|   int n_xa = xa.size(), n_xb = xb.size();
| 
|   Rcpp::NumericVector xab(n_xa + n_xb - 1);
|   for (int i = 0; i < n_xa; i++)
|   for (int j = 0; j < n_xb; j++)
|   xab[i + j] += xa[i] * xb[j];
|   return xab;
|   '
| 
| fun <- cxxfunction(signature(a = "numeric", b = "numeric"),src, plugin
| = "Rcpp", verbose=TRUE)
| 
| The error messages that I get:
| 
| Compilation argument:
|  C:/R/R-2.13.2/bin/i386/R CMD SHLIB file44d370a0.cpp 2>
| file44d370a0.cpp.err.txt
| 
| ERROR(s) during compilation: source code errors or compiler
| configuration errors!
| 
| 
| Error in compileCode(f, code, language = language, verbose = verbose) :
| Compilation ERROR, function(s)/method(s) not created!
| 
| In addition: Warning message:
| running command 'C:/R/R-2.13.2/bin/i386/R CMD SHLIB file44d370a0.cpp
| 2> file44d370a0.cpp.err.txt' had status 1
| 
| 
| My question:
| If an error file is actually being written, where do i find it?
| Is this a common error where perhaps you can already see the problem?

The file is written to R's default temporary directory. On my unix system

   R> tempdir()
   [1] "/tmp/Rtmpm7Wpwe"
   R> tempfile()
   [1] "/tmp/Rtmpm7Wpwe/file1eb9dd12"
   R>

R cleans that temporary directory after the session ends. If you call R CMD
... from teh commandline, the temp. directory is also, well, temporary.

You can overrride the defaults for TMP, TEMP or TEMPDIR (gotta love
WIndows...) or simply cut&paste after using verbose=TRUE as you did.


My best guess is that you have not installed the Rtools correctly.  Can you
compile a simple 'hello, world' example in C or C++?  Can you rebuild R
packages from source?

Dirk

 
| 
| Thank you,
| 
| Slava
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list