<div dir="ltr"><div><div><div><div>Dear all,<br><br></div><div>I am starting to study the Rcpp package. I am reading the Rcpp book, butI have a problem on Listing 2.8 from Rcpp book. This listing is about Creating Plugins.<br></div><br><br></div><div>## The C++ code<br></div><div>gslrng <-'<br>int seed = Rcpp::as<int>(par) ;<br>gsl_rng_env_setup();<br>gsl_rng *r = gsl_rng_alloc (gsl_rng_default);<br>gsl_rng_set (r, (unsigned long) seed);<br>double v = gsl_rng_get (r);<br>gsl_rng_free(r);<br>return Rcpp::wrap(v);<br>'<br><br></div><div>## Creating the plugin<br></div><div>plug <- Rcpp:::Rcpp.plugin.maker(<br>    include.before = "#include <gsl/gsl_rng.h>",<br>     libs = paste("-L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp",<br>                  "-Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib",<br>                  "-L/usr/lib -lgsl -lgslcblas -lm"))<br><br></div><div>## Run<br></div><div>registerPlugin("gslDemo", plug)<br>fun <- cxxfunction(signature(par="numeric"), gslrng, plugin ="gslDemo", verbose=TRUE)<br><br></div>When I try compile I received this error message<br><br>Error in compileCode(f, code, language = language, verbose = verbose) : <br>  Compilation ERROR, function(s)/method(s) not created! /usr/bin/ld: cannot find -lRcpp<br>collect2: error: ld returned 1 exit status<br>make: *** [file1a3c6aca3e2e.so] Error 1<br><br></div>Any help is welcome.<br><br></div>Thank you!<br clear="all"><div><div><div><div><div><div><div><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Wagner Hugo Bonat<br>----------------------------------------------------------------------------------------------<br>Department of Mathematics and Computer Science (IMADA)<br>University of Southern Denmark (SDU) and<br>Laboratório de Estatística e Geoinformação (LEG)<br>Universidade Federal do Paraná (UFPR)<br><br></div></div></div></div></div>
</div></div></div></div></div></div></div></div></div></div>