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"<[email protected]>;
Date: Sep 4, 2013
To: "guxiaobo1982"<[email protected]>;
Cc: "Dirk Eddelbuettel"<[email protected]>;
"rcpp-devel"<[email protected]>;
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 | [email protected] | http://dirk.eddelbuettel.com
._______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel