[Rcpp-devel] sourceCpp error

Subodh Acharya shoebodh at gmail.com
Mon Apr 29 15:24:27 CEST 2013


Hi Kevin,

I am running R with RStudio. The OS is windows 7 64bit. Here is my
sessionInfo() output.
R version 2.15.3 (2013-03-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=C

[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rcpp_0.10.2

loaded via a namespace (and not attached):
[1] tools_2.15.3

My R.home...
R.home()
[1] "C:/R/R-215~1.3"

I have both R 3.0.0 and 2.15.3 installed in my computer, both at C:\R. and
I have Rtools30 installed.
All these are added in my path.

I also uninstalled all of them and re-installed but the error is persistent.
As I said, if I write a function and added it to my package \src folder and
build, it works perfectly fine but none of the individual functions can't
be compiled ( which were working perfectly earlier).


Please let me know if you need any further information on this.. Thanks a
lot.


Subodh




On Sun, Apr 28, 2013 at 11:15 PM, Kevin Ushey <kevinushey at gmail.com> wrote:

> 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/20130429/87fa0d34/attachment.html>


More information about the Rcpp-devel mailing list