[Rcpp-devel] Question about Rcpp and boost

Jordi Molins Coronado jordi_molins at hotmail.com
Wed Mar 11 12:58:14 CET 2015


Hello,
I know this question has been answered before (and I have searched for it), but I cannot figure out a solution:
I want to use boost with Rcpp, basically to be able to use numbers with a higher precision than a double. I am comfortable using the inline package for small c++ functions, I have never used Rccp per se. I have created a skeleton with convolve, and it works. I have added a new function:
// We can now use the BH package// [[Rcpp::depends(BH)]]
#include <Rcpp.h>#include <boost/math/common_factor.hpp>  
using namespace Rcpp; // [[Rcpp::export]]int computeGCD(int a, int b) {    return boost::math::gcd(a, b);}
and when I try to compile, it fails (basically, the compiler does not find where boost is). I have then run in R:
Sys.setenv("PKG_CXXFLAGS"="-I C:/Program~Files/boost/boost_1_57_0/")
which allows me to go a bit more into the build, but the compile fails when reaching the #include <boost/math/common_factor.hpp>  above, since it does not know where boost is (boost is at C:/Program~Files/boost/boost_1_57_0/ I have not compiled it, but just extracted with 7-zip and copied and pasted the corresponding files into this subfolder).
>From reading the attribute document of Dirk Eddelbuettel, it seems as if adding the comments // [[Rcpp::export]] and // [[Rcpp::depends(BH)]] would do the job. But for me, it does not work. What do I need to do? Thanks and sorry for the basic question, I have tried to read everything I could before asking this list. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150311/c05775a0/attachment.html>


More information about the Rcpp-devel mailing list