-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
When trying to implement a Rcpp module to expose a C++ class I get an error about I get the following error:
/usr/include/c++/9/bits/stl_vector.h:509:30: required from ‘std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = double; _Alloc = std::allocator<double>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<double>]’/home/pingu/lib64/R-4.0.3/library/Rcpp/include/Rcpp/sugar/functions/sample.h:153:28: required from here/usr/include/c++/9/bits/stl_uninitialized.h:597:18: error: ‘value’ is not a member of ‘std::is_copy_assignable<double>’ const bool __assignable = is_copy_assignable<_ValueType>::value; ^~~~~~~~~~~~make: *** [/home/pingu/lib64/R-4.0.3/etc/Makeconf:181: file388d7a0874cb.o] Error 1
It turns out that this error message is independent on the particular module code and also happens with all module examples as provided with the package (this is the minimal example):
library('inline')
library('Rcpp')
unifModCode = '
using namespaceRcpp;
/// create external pointer to a Uniform object
RcppExport SEXP Uniform__new(SEXPmin_,SEXPmax_) {
// convert inputs to appropriate C++ types
double min = as<double>(min_),max = as<double>(max_);
// create pointer to an Uniform object and
// wrap it as an external pointer
Rcpp::XPtr<Uniform>ptr(newUniform( min, max ),true);
// return the external pointer to the R side
return ptr;}
/// invoke the draw method
RcppExport SEXP Uniform__draw(SEXP xp, SEXPn_) {
// grab the object as a XPtr (smart pointer)
// to UniformRcpp::XPtr<Uniform> ptr(xp);
// convert the parameter to int
int n = as<int>(n_);
// invoke the function
NumericVector res = ptr->draw( n );
// return the result to Rreturnres;}
}';
f1<-cxxfunction( ,"",includes =unifModCode,plugin ="Rcpp");
## will display info about'f1
getDynLib(f1)
My sessionInfo is:
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.2
Matrix products: default
BLAS: /home/user/lib64/R-4.0.3/lib/libRblas.so
LAPACK: /home/user/lib64/R-4.0.3/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=de_DE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Rcpp_1.0.6 inline_0.3.17
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3 codetools_0.2-16
The compiler version is:
g++ --version
g++ (SUSE Linux) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
The following complier command was generated:
g++ -std=gnu++11 -I"/home/pingu/lib64/R-4.0.3/include" -DNDEBUG -I"/home/pingu/lib64/R-4.0.3/library/Rcpp/include" -I/usr/local/include -L"/home/pingu/Documents/src/mmap/build" -lmmap_rcpp -I/home/pingu/lib64/R-4.0.3/library/Rcpp/include -I/usr/include/c++/9 -fpic -g -O2 -c file388d7a0874cb.cpp -o file388d7a0874cb.o
Thank you very much in advance. Any help appreciated.
Metadata
Metadata
Assignees
Labels
No labels