<div dir="ltr">Hi Subodh,<div><br></div><div>Can you give some more information about your system -- specifically, the output of sessionInfo() in an R session? Also, are you running this from an R session in your terminal, or some other system (RStudio, RKWard etc.)</div>
<div><br></div><div style>-Kevin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 28, 2013 at 7:20 PM, Subodh Acharya <span dir="ltr"><<a href="mailto:shoebodh@gmail.com" target="_blank">shoebodh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>But now after I updated to Rcpp 0.10.3, whenever I sourceCpp, it throws a 'unused arguement' error.</div><div><div>However when I use the all the functions to build a package, it works fine.</div>

<div><br></div><div>I think  this is a really small problem, but its beyond my knowledge of c++ </div><div>Any help will be greatly appreciated.</div></div><div><br></div><div>Following are simple  example codes and the error I am getting.. <br>

</div><div><br></div><div><br></div><div><br></div><div><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><br></div><div>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><br></div><div> 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>Thanks in advance.</div></div><div>
<br></div></div></div>
<br>_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br></blockquote></div><br><br clear="all"><div>
<br></div>-- <br><div dir="ltr">-Kevin</div>
</div>