我是Rcpp的初学者。我能问一个非常基本的问题吗?以下是简单的代码:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
int test(char d) {
char c;
c=d;
return 0;
}
但是当我尝试编译它时,我总是得到如下错误:
/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
sourceCpp("test1.cpp") 中的错误:构建共享库时发生错误 1。
你能告诉我会发生什么吗?非常感谢!