[Rcpp-devel] Multiple definition problem with RcppArmadillo:sample() function during package compilation

Dirk Eddelbuettel edd at debian.org
Sat Aug 24 02:47:30 CEST 2013


Hi,

On 23 August 2013 at 19:33, Subodh Acharya wrote:
|  I am a beginner in Rcpp and I am very much enjoying the amazing Rcpp and
| RcppArmadillo. It has really boosted my speed.
| I am making an R package that links to the RcppArmadillo to call its new sample
| () function. I have several different functions ( defined in separate .cpp
| files) that call the RcppArmadillo::sample(). 
|  But whenever I call sample() in more than 1 file, I get the error during
| package compilation. However, if I use the RcppArmadillo: sample() in only one
| place and use R's sample() function, the package is compiled fine. 
| Obviously, there is a multiple definition problem (from the message) but I
| could not solve it. Any help will be highly appreciated. 

That may be a problem at our end in the design of the contributed sample.h
file.  Someone recently noticed the same issue with sparse matrix conversion
I had added in a similar fashsion; Romain has since cleaned this up and moved
it into RcppArmadillo proper.

For now, your best (only?) bet may be to organize your code in such a way
that sample.h gets included only once.  

Sorry, Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list