<div dir="ltr">Hi, I am a beginner-class use of the amazing Rcpp. I am using to simulate finite state Markov chains. <div>Previously all the c++ function I wrote were working perfectly. I compiled all my functions in package and they work fine.</div>
<div><br></div><div style>But now after I updated to Rcpp 0.10.3, whenever I sourceCpp, it throws a 'unused arguement' error.</div><div style><div>However when I use the all the functions to build a package, it works fine.</div>
<div><br></div><div style>I think  this is a really small problem, but its beyond my knowledge of c++ </div><div style>Any help will be greatly appreciated.</div></div><div style><br></div><div style>Following are simple  example codes and the error I am getting.. <br>
</div><div style><br></div><div style><br></div><div style><br></div><div style><div>cppFunction('</div><div>+   int add(int x, int y, int z) {</div><div>+     int sum = x + y + z;</div><div>+     return sum;</div><div>
+   }'</div><div>+ )</div><div>Error in Rcpp:::sourceCppFunction(function(x, y, z) { : </div><div>  unused argument ("sourceCpp_94801_add")</div><div><br></div><div style><br></div><div style>Second example code </div>
<div><br></div><div>  #include <Rcpp.h><br></div><div><div>#include <iostream></div><div>#include <vector></div><div><br></div><div>// [[Rcpp::export]]</div><div><br></div><div>using namespace Rcpp;</div>
<div>using namespace std;</div><div><br></div><div> </div><div>int mcfunC(int oldState, NumericVector states, NumericMatrix prob_mat){</div><div><br></div><div>RNGScope scope;</div><div><br></div><div>NumericVector newState(1);</div>
<div><br></div><div>int pixel = oldState;</div><div><br></div><div>  Environment base("package:base");</div><div>  Function sample = base["sample"];</div><div> </div><div> newState = sample(states, Named("size", 1), Named("prob", prob_mat(pixel, _)));</div>
<div>  </div><div> int state_new = newState[0];</div><div>  </div><div>  return(state_new);</div><div>  </div><div> }</div><div>  </div><div style><br></div><div style> Rcpp::sourceCpp('src/mcfunC.cpp')<br></div><div>
Error in Rcpp:::sourceCppFunction(function(oldState, states, prob_mat) { : </div><div>  unused argument ("sourceCpp_20302_mcfunC") </div><div>  </div><div>  </div><div style>Thanks in advance.</div></div><div style>
<br></div></div></div>