[Rcpp-devel] Rcpp compile question

Henry Bee henry.bee at gmail.com
Mon Mar 21 04:11:31 CET 2011


Hi Dirk,

I've been developing with R for the past year and came across your wonderful
presentation slides on Rcpp a few months ago. I am now turning to your Rcpp
package to translate the slowest portion of my code to C/C++.

I am testing the first example provided on page 6 in
your Rcpp-introduction.pdf document. Unfortunately I am getting compile
errors (listed below). Could you provide some guidance?

Kind regards,

Henry


ERROR(s) during compilation: source code errors or compiler configuration
errors!
Program source:
  1:
  2: // includes from the plugin
  3:
  4: #include <Rcpp.h>
  5:
  6:
  7: #ifndef BEGIN_RCPP
  8: #define BEGIN_RCPP
  9: #endif
 10:
 11: #ifndef END_RCPP
 12: #define END_RCPP
 13: #endif
 14:
 15: using namespace Rcpp;
 16:
 17:
 18: // user includes
 19:
 20:
 21: // declarations
 22: extern "C" {
 23: SEXP file3665625e( SEXP a, SEXP b) ;
 24: }
 25:
 26: // definition
 27:
 28: SEXP file3665625e( SEXP a, SEXP b ){
 29: BEGIN_RCPP
 30:
 31:  Rcpp::NumericVector xa(a);
 32:  Rcpp::NumericVector xb(b);
 33:  int n_xa = xa.size(), n_xb = xb.size();
 34:
 35:  Rcpp::NumericVector xab(n_xa + n_xb - 1);
 36:  for (int i = 0; i < n_xa; i++)
 37:  for (int j = 0; j < n_xb; j++)
 38:  xab[i + j] += xa[i] * xb[j];
 39:  return xab;
 40:
 41: END_RCPP
 42: }
 43:
 44:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created!
In addition: Warning message:
running command 'C:\PROGRA~1\R\R-212~1.2/bin/i386/R CMD SHLIB
file3665625e.cpp 2> file3665625e.cpp.err.txt' had status 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110320/3aa99b0c/attachment.htm>


More information about the Rcpp-devel mailing list