[Rcpp-devel] Rcpp plugin use adding -I for current directory

Dirk Eddelbuettel edd at debian.org
Thu Apr 12 18:31:21 CEST 2012


Someone recently asked (and I can't find it here so it may have been on
StackOverflow) how to tell inline to also consider the current working
directory for includes.

I answered that one can't as inline / cxxfunction always switches to a
temporary directory created by R.  Turns out that one can in fact, as it is
the known current working directory.  Romain had added this in one of our
examples:

	settings <- getPlugin("Rcpp")
	settings$env$PKG_CXXFLAGS <- paste("-I", getwd(), sep="")

and then uses   settings=settings   in the call to cxxfunction.  

Nice trick.

Regards,  Dirk

-- 
R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com


More information about the Rcpp-devel mailing list