R/C++ Interface
How to use RCPP_MODULE(yada) in C++. My C++ program gives error if I use
const char* hello( std::string who ){
std::string result( "hello " ) ;
result += who ;
return result.c_str() ;
}
RCPP_MODULE(yada)
{
using namespace std;
function( "hello", &hello ) ;
};
Error are:
1. Error 1 error C2065: 'yada' : undeclared ide开发者_如何学运维ntifier 2. Error 2 error C2448: 'RCPP_MODULE' : function-style initializer appears to be a function definitionCan anyone help me in fixing these error?
Rcpp does not work with Visual Studio, see Question 2.7 in Rcpp FAQ.
The point of RCPP_MODULE
is to expose C++ to R.
You need to include R.h
and Rdefines.h
and state using namespace Rcpp;
精彩评论