I am using RStudio on Ubuntu 16.04 LTS and have created code for an R package using Rcpp.
My code worked fine until I moved it in to the R package. Now I am getting the error:
error: ‘unique_ptr’ is not a member of ‘std’
The guilty line of code is:
typedef std::list<std::unique_ptr<Random> > ears_t;
The top of my cpp file contains reference to the cpp11 plugin
// [[Rcpp::plugins(cpp11)]]
// [[Rcpp::depends(BH)]]
#include <Rcpp.h>
#include <vector>
#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
using namespace Rcpp;
The description file links to and imports the various packages:
LinkingTo: Rcpp, BH
Imports: Rcpp, BH, raster, XML
I have seen one post that suggests the problem relates to the non-inclusion of the memory class and another that relates to C++11.
Either way I am unsure how to solve the issue. Any suggestions would be greatly appreciated.
For packages with C++11 you want to have the following in your DESCRIPTION file:
SystemRequirements: C++11
As suggested by Dirk another possibility is adding the following to a src/Makevars{.win} file:
CXX_STD=C++11
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With