[Rcpp-devel] Question about Rcpp and boost

Jordi Molins Coronado jordi_molins at hotmail.com
Wed Mar 11 13:09:47 CET 2015

Thank you very much for your answer. I have changed the DESCRIPTION file to include:
LinkingTo: Rcpp, BH
(before: LinkingTo: Rcpp) but it continues giving the same build error.
Date: Wed, 11 Mar 2015 07:05:39 -0500
Subject: Re: [Rcpp-devel] Question about Rcpp and boost
From: deter088 at umn.edu
To: jordi_molins at hotmail.com
CC: rcpp-devel at lists.r-forge.r-project.org

I think you want to check your DESCRIPTION file.  I believe you need to have the 'LinkingTo:' option to also include BH.
On Wed, Mar 11, 2015 at 6:58 AM, Jordi Molins Coronado <jordi_molins at hotmail.com> wrote:

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. 		 	   		  


Rcpp-devel mailing list

Rcpp-devel at lists.r-forge.r-project.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150311/65a2343f/attachment.html>

More information about the Rcpp-devel mailing list