[Rcpp-devel] Question about Rcpp and boost

Charles Determan Jr deter088 at umn.edu
Wed Mar 11 13:05:39 CET 2015


I think you want to check your DESCRIPTION file.  I believe you need to
have the 'LinkingTo:' option to also include BH.

Regards,
Charles

On Wed, Mar 11, 2015 at 6:58 AM, Jordi Molins Coronado <
jordi_molins at hotmail.com> wrote:

> 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.
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20150311/09729ca2/attachment.html>


More information about the Rcpp-devel mailing list