On 8 May 2019 at 09:43, Simon Urbanek wrote: | It fails for me on Linux as well: [...] | [Ubuntu 18.04.1 LTS; clang 7.0.0-3~ubuntu0.18.04.1]
I can confirm that on Ubuntu 18.10 if I uncomment / reset these in ~/.R/Makevars: CXX=ccache clang++ CXX11=ccache clang++ CC=ccache clang SHLIB_CXXLD=clang CXXFLAGS=-Wall -O3 Yet it also works as soon as remove the (understandable, from a pure C++ viewpoint) reference semantic (which with SEXP object is a lie anyway). R> Rcpp::sourceCpp("/tmp/robin.cpp", verbose=TRUE, rebuild=TRUE) Generated extern "C" functions -------------------------------------------------------- #include <Rcpp.h> Generated R functions ------------------------------------------------------- `.sourceCpp_1_DLLInfo` <- dyn.load('/tmp/Rtmp6RAHjE/sourceCpp-x86_64-pc-linux-gnu-1.0.1.2/sourcecpp_314b38b4e773/sourceCpp_6.so') library(Rcpp) populate( Rcpp::Module("MyModel",`.sourceCpp_1_DLLInfo`), environment() ) rm(`.sourceCpp_1_DLLInfo`) Building shared library -------------------------------------------------------- DIR: /tmp/Rtmp6RAHjE/sourceCpp-x86_64-pc-linux-gnu-1.0.1.2/sourcecpp_314b38b4e773 /usr/lib/R/bin/R CMD SHLIB -o 'sourceCpp_6.so' --preclean 'robin.cpp' ccache clang++ -I"/usr/share/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/tmp" -fpic -Wall -O3 -c robin.cpp -o robin.o clang -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o sourceCpp_6.so robin.o -L/usr/lib/R/lib -lR R> Repaired code (which whitespace and identation to my and Emacs's liking) below. Dirk ----------------------------------------------------------------------------- #include <Rcpp.h> using namespace Rcpp; class MyModel { public: double a; ~MyModel(); MyModel(); MyModel(const Rcpp::NumericVector ModelData, int temp); }; RCPP_EXPOSED_CLASS(MyModel) MyModel::~MyModel() {} MyModel::MyModel() : a(0) {} MyModel::MyModel(const Rcpp::NumericVector ModelData, int temp) : a(0) {} RCPP_MODULE(MyModel) { Rcpp::class_<MyModel>("MyModel") .constructor() .constructor<const Rcpp::NumericVector, int>() ; } ----------------------------------------------------------------------------- -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel