[Rcpp-devel] Exporter.h cannot convert 'SEXP' to 'const std::vector<double>*' in initialization

Jean-Michel.Perraud at csiro.au Jean-Michel.Perraud at csiro.au
Wed Oct 23 06:12:33 CEST 2013


Hi,

This has to be a basic question, but I cannot figure out what I am missing nor see quite similar pre-existing posts.

I am trying to create an Rcpp module around a class (generated C++ proxy class). The environment is Rcpp 0.10.5 on Windows, R 3.0.2 x64 and RTools 3.0.

R CMD INSTALL spits the dummy at compilation(?) time when the Exporter things kick in, with the message " cannot convert 'SEXP' to 'const std::vector<double>*' in initialization" on the 'Play' method as per below.

class SimulationExport {
public:
  SimulationExport();
  ~SimulationExport();
  void Execute(void);
  void Play(const char* name, const std::vector<double>* values);
// other methods snipped
}

RCPP_MODULE(SimulationEx){
    class_<SimulationExport>( "Simulation" )
// snipped
    .method( "play", &SimulationExport::Play)
// snipped
}

I don't get why it cannot wrap a vector<double> given how similar it is to "7.2.2.7 Full Example" in the " Seamless R and C++ Integration with Rcpp" book. The same sample code created with Rcpp.package.skeleton compiles (though it fails check on load, BTW). The only difference is the presence of a 'const' modifier before the vector, but removing it does not solve the issue.

Rcpp.package.skeleton('sampleRcpp', module=TRUE, author='J-M')
library(devtools)
check('sampleRcpp') # passes past the compilation step.

Cheers,
J-M


More information about the Rcpp-devel mailing list