[Rcpp-devel] Question about using Rcpp to integrate C++ code with Boost Graph Library

Dirk Eddelbuettel edd at debian.org
Sat Jan 19 15:29:48 CET 2013


Hi,

On 19 January 2013 at 08:14, Song, Won-min wrote:
| 
| Hi, 
| I am a new beginner in using Rcpp with C++. 
| I have a piece of C++ code with Rcpp and boost graph library, and am trying to
| make a package with helps from Rcpp.package.skeleton() command. 
| 
| When I try to install the package with Rcmd INSTALL pkgname (I'm running on
| windows machine), it seems that it is not recognizing the boost library by
| displaying error messages that it is not recognizing the header files from
| boost. I used the following Makevars.win file in the src directory: 
| 
| PKG_LIBS = $(shell ${R_HOME}/bin/Rscript.exe -e "Rcpp:::LdFlags()")
| PKG_CPPFLAGS = -L "C:/Users/Won/Documents/Boost/boost_1_51/lib" -lboost_graph
| 
| C:/Users/Won/Documents/Boost/boost_1_51/lib is the directory where the .dll
| files live. 
| Would you be able to point me in the right direction? Is there something I've
| done wrong in Makevars.win file? 

You added the _linker_ arguments to the _header_ flag. That is wrong: -L/-l
belong to PKG_LIBS.

Try in the src/ directory to decompose the steps into

    R CMD COMPILE mylib.dll *.cpp

and

    R CMD SHLIB mylib.dll

(or some other name for mylib) to see that you can a) compile (does g++ find
headers) and b) link (does g++ find the dll).

Dirk

| 
| Any comments would be greatly appreciated.
| 
| Thanks,
| 
| ----------------------------------------------------------------------
| _______________________________________________
| 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
-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list