[Rcpp-devel] sourceCpp error

Kevin Ushey kevinushey at gmail.com
Mon Apr 29 05:15:46 CEST 2013


Hi Subodh,

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.)

-Kevin


On Sun, Apr 28, 2013 at 7:20 PM, Subodh Acharya <shoebodh at gmail.com> wrote:

> 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.
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>



-- 
-Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130428/10b53063/attachment.html>


More information about the Rcpp-devel mailing list