[Rcpp-devel] Regular Expressions
On Sat, Mar 2, 2013 at 10:17 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
On 1 March 2013 at 23:03, Gabor Grothendieck wrote: | On Fri, Mar 1, 2013 at 9:50 PM, Dirk Eddelbuettel <edd at debian.org> wrote: | > | > On 1 March 2013 at 21:24, Hadley Wickham wrote: | > | > | I searched BH for regex and found nothing so I don't think BH includes | > | > | Boost.Regex. | > | > | > | > Could you register an issue ticket at the r-forge page for BH, please? There | > | > are other things missing too, of course, as we started pretty with the needs | > | > of "just" bigmemory and RcppBDT. | > | | > | But Boost.Regex isn't header only? | > | > Yup. Found that out the hard way when I wrote it up as a piece for the Rcpp | > Gallery. You do need to link. | > | > Piece now up at http://gallery.rcpp.org/articles/boost-regular-expressions/ | > | | I have downloaded boost such that I have this file: | | C:\MinGW\lib\libboost_regex.a | | How do I tell Rcpp to use it? Follow eg the Rcpp Gallery story and use Sys.setenv("PKG_LIBS"="C:\MinGW\lib\libboost_regex.a") as static library can be given "as is". Else try Sys.setenv("PKG_LIBS"="-LC:\MinGW\lib\ -lboost_regex") which is the standard form. That should work with the example I posted. If everthing else, try the documentation for Rcpp (Rcpp-package vignette in particular) or Boost.
Thanks. I doubled each backslash but unfortunately neither work.
I am able to build the original credit_card_example from the boost
site independently of Rcpp, i.e. this builds and I can run the result:
rem this works
C:\MinGW\set_distor_paths.bat
g++ credit_card_example.cpp -o credit_card_example.exe -lboost_regex
and can also build C++ scripts not using boost; however,
all of the following give:
credit.cpp:6:27: fatal error: boost/regex.hpp: No such file or directory
library(Rcpp)
Sys.setenv("PKG_LIBS"="C:\\MinGW\\lib\\libboost_regex.a")
sourceCpp("credit.cpp", verbose = TRUE)
library(Rcpp)
Sys.setenv("PKG_LIBS"="-LC:\\MinGW\\lib\\ -lboost_regex")
sourceCpp("credit.cpp", verbose = TRUE)
library(Rcpp)
Sys.setenv("PKG_LIBS"="-lboost_regex")
sourceCpp("credit.cpp", verbose = TRUE)
I also tried with Cygwin. I have this file among others:
C:\cygwin\lib\libboost_regex-mt.dll.a
and tried these but they give the same result:
library(Rcpp)
Sys.setenv("PKG_LIBS"="C:\\cygwin\\lib\\libboost_regex-mt.dll.a")
sourceCpp("credit.cpp", verbose = TRUE)
library(Rcpp)
Sys.setenv("PKG_LIBS"="-LC:\\cygwin\\lib\\ -lboost_regex")
sourceCpp("credit.cpp", verbose = TRUE)
Changing backslash to forward slash does not change anything.
Everything was done with the svn version of Rcpp:
packageVersion("Rcpp")
[1] '0.10.2.5'