I am the beginner of Rcpp. Could I ask a very basic question? The following is the simple code:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
int test(char d) {
char c;
c=d;
return 0;
}
But when I try to compile it, I always get the error like:
/usr/local/genomics/programs/R-3.0.0/library/Rcpp/include/Rcpp/as.h: In function ‘T Rcpp::internal::as_string(SEXPREC*, Rcpp::traits::false_type) [with T = char]’:
/usr/local/genomics/programs/R-3.0.0/library/Rcpp/include/Rcpp/as.h:66: instantiated from ‘T Rcpp::internal::as(SEXPREC*, Rcpp::traits::r_type_string_tag) [with T = char]’
/usr/local/genomics/programs/R-3.0.0/library/Rcpp/include/Rcpp/as.h:126: instantiated from ‘T Rcpp::as(SEXPREC*) [with T = char]’
test1.cpp:18: instantiated from here
/usr/local/genomics/programs/R-3.0.0/library/Rcpp/include/Rcpp/as.h:62: error: invalid conversion from ‘const char*’ to ‘char’
make: *** [test1.o] Error 1
g++ -I/usr/local/genomics/programs/R-3.0.0/include -DNDEBUG -I/usr/local/include -I"/usr/local/genomics/programs/R-3.0.0/library/Rcpp/include" -fpic -g -O2 -c test1.cpp -o test1.o
Error in sourceCpp("test1.cpp") : Error 1 occurred building shared library.
Could you tell me what happens? Thank you very much!