[Rcpp-devel] Question about Rcpp and boost

Jordi Molins Coronado jordi_molins at hotmail.com
Wed Mar 11 13:26:33 CET 2015


I have restarted everything, and now I can already compute GCD using the boost library, thank you for your help. Just an annoying thing: when I do:
sourceCpp("convolve.cpp")
I get a warning, which I did not get the first time I built my project (without the boost file).
Warning message:In normalizePath(path.expand(path), winslash, mustWork) :  path[1]="C:/Users/Jordi/Documents/[A_FOLDER]/JungleR/JungleR/src/../inst/include": The system cannot find the path specified
Do you know what can that be? I will definitely look into the examples in BH library, thanks for the recommendation.
Date: Wed, 11 Mar 2015 07:21:49 -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

Could you provide the build error you are referring to?  You shouldn't need to change the PKG_CXXFLAGS variable at all.  Try restarting your environment and rebuilding.  I just created a package containing your code with the BH package without error on Windows 7.
On Wed, Mar 11, 2015 at 7:09 AM, Jordi Molins Coronado <jordi_molins at hotmail.com> wrote:



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.
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



 		 	   		  


-- 
Dr. Charles Determan, PhD
Integrated Biosciences

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


More information about the Rcpp-devel mailing list