I tried this ## Use the R_HOME indirection to support installations of multiple R version PKG_CPPFLAGS=-I/opt/boost_1_54_0/include -I../inst/include PKG_LIBS=-L/opt/boost_1_54_0/lib -lboost_regex `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` and this: ## Use the R_HOME indirection to support installations of multiple R version PKG_CPPFLAGS=-I/opt/boost_1_54_0/include -I../inst/include PKG_LIBS = -L/opt/boost_1_54_0/lib -lboost_regex `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` Still got ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/amber/R/x86_64-redhat-linux-gnu-library/3.0/cpptest/libs/cpptest.so': /home/amber/R/x86_64-redhat-linux-gnu-library/3.0/cpptest/libs/cpptest.so: undefined symbol: _ZTIN4Rcpp7RObjectE Error: loading failed Execution halted ERROR: loading failed * removing ?/home/amber/R/x86_64-redhat-linux-gnu-library/3.0/cpptest? * restoring previous ?/home/amber/R/x86_64-redhat-linux-gnu-library/3.0/cpptest? Exited with status 1. ------------------ Original ------------------ From: "Dirk Eddelbuettel"<edd at debian.org>; Date: Sep 4, 2013 To: "guxiaobo1982"<guxiaobo1982 at qq.com>; Cc: "Dirk Eddelbuettel"<edd at debian.org>; "rcpp-devel"<rcpp-devel at lists.r-forge.r-project.org>; Subject: Re: [Rcpp-devel] How to use external C++ libraries in R packages withRcpp.
On 4 September 2013 at 18:21, guxiaobo1982 wrote:
| Hi Dirk,
|
| Thanks for you help, here is wha I got in a test package:
|
| 1.Rcpp.package.skeleton("cpptest")
Good start!
| 2. Add the following line to Makevars
|
| PKG_CPPFLAGS=-I/opt/boost_1_54_0/include -I../inst/include PKG_LIBS = -L/opt/
| boost_1_54_0/lib -lboost_regex `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
Those have to be __two distinct lines__ not one glued together. Try
PKG_CPPFLAGS=-I/opt/boost_1_54_0/include -I../inst/include
PKG_LIBS = -L/opt/boost_1_54_0/lib -lboost_regex `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
ie one assignment each to two variables PKG_CPPFLAGS and PKG_LIBS.
| 3. Change rcpp_hello_world.cpp to this:
Looks good, and should work. Boost Regex use is a nice small example.
Dirk
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com . -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130905/90a4ad55/attachment.html>