[Rcpp-devel] sourceCpp error

Subodh Acharya shoebodh at gmail.com
Mon Apr 29 04:20:47 CEST 2013


Hi, I am a beginner-class use of the amazing Rcpp. I am using to simulate
finite state Markov chains.
Previously all the c++ function I wrote were working perfectly. I compiled
all my functions in package and they work fine.

But now after I updated to Rcpp 0.10.3, whenever I sourceCpp, it throws a
'unused arguement' error.
However when I use the all the functions to build a package, it works fine.

I think  this is a really small problem, but its beyond my knowledge of c++
Any help will be greatly appreciated.

Following are simple  example codes and the error I am getting..



cppFunction('
+   int add(int x, int y, int z) {
+     int sum = x + y + z;
+     return sum;
+   }'
+ )
Error in Rcpp:::sourceCppFunction(function(x, y, z) { :
  unused argument ("sourceCpp_94801_add")


Second example code

  #include <Rcpp.h>
#include <iostream>
#include <vector>

// [[Rcpp::export]]

using namespace Rcpp;
using namespace std;


int mcfunC(int oldState, NumericVector states, NumericMatrix prob_mat){

RNGScope scope;

NumericVector newState(1);

int pixel = oldState;

  Environment base("package:base");
  Function sample = base["sample"];

 newState = sample(states, Named("size", 1), Named("prob", prob_mat(pixel,
_)));

 int state_new = newState[0];

  return(state_new);

 }


 Rcpp::sourceCpp('src/mcfunC.cpp')
Error in Rcpp:::sourceCppFunction(function(oldState, states, prob_mat) { :
  unused argument ("sourceCpp_20302_mcfunC")


Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130428/d41f06a8/attachment.html>


More information about the Rcpp-devel mailing list