Hi Won-min,<div><br></div><div>1) There shouldn't be a space between -L and the directory containing your boost libraries. Also, ensure that the libboost_graph.a file is available in that directory as well -- is there a chance that you have 'libboost_graph-mt.a', the multi-threaded flavor, instead?</div>
<div><br></div><div>2) You don't want to wrap the whole expression in parentheses. The Rcpp library location is found by calling Rscript and checking Rcpp:::LdFlags() through a shell on Windows.</div><div><br></div><div>
It's better to have the directory containing your boost libraries somewhere in your PATH, so that you simply need to put '-lboost_graph' in the PKG_LIBS variable. So, try:</div><div><br></div><div>PKG_LIBS = $(shell ${R_HOME}/bin/Rscript.exe -e "Rcpp:::LdFlags()") -L"C:/Users/Won/Documents/Boost/boost_1_51/lib" -lboost_graph</div>
<div><br></div><div>or, perhaps better,</div><div><br></div><div>PKG_LIBS = $(shell ${R_HOME}/bin/Rscript.exe -e "Rcpp:::LdFlags()") -lboost_graph</div><div><br></div><div>with the library found somewhere in your PATH.</div>
<div><br></div><div>-Kevin</div><div><br><div class="gmail_quote">On Sun, Jan 20, 2013 at 8:31 PM, Song, Won-min <span dir="ltr"><<a href="mailto:won-min.song@mssm.edu" target="_blank">won-min.song@mssm.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dirk,<br>
<br>
Thanks alot for your reply. Nevertheless, it doesn't seem I don't have `Rcmd COMPILE' running in my R.<br>
I do have other functions such as Rcmd INSTALL, build etc, but couldn't find 'COMPILE' from the Rcmd options in the help display.<br>
<br>
After you pointed out that I should have used -L/-I options in PKG_LIBS, I tried the following in Makevars.win file:<br>
<br>
PKG_LIBS = $(shell ${R_HOME}/bin/Rscript.exe -e "Rcpp:::LdFlags()" -L "C:/Users/Won/Documents/Boost/boost_1_51/lib" -lboost_graph)<br>
<br>
and it still doesn't recognize boost library.<br>
<br>
As I am rather a beginner in R, it is likely that there is something missing. Could you or anyone direct me to right direction?<br>
<br>
Thanks,<br>
<br>
Won<br>
________________________________________<br>
From: Dirk Eddelbuettel [<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>]<br>
Sent: Saturday, January 19, 2013 9:29 AM<br>
To: Song, Won-min<br>
Cc: <a href="mailto:rcpp-devel@lists.r-forge.r-project.org" target="_blank">rcpp-devel@lists.r-forge.r-project.org</a><br>
Subject: Re: [Rcpp-devel] Question about using Rcpp to integrate C++ code with Boost Graph Library<br>
<div><div><br>
Hi,<br>
<br>
On 19 January 2013 at 08:14, Song, Won-min wrote:<br>
|<br>
| Hi,<br>
| I am a new beginner in using Rcpp with C++.<br>
| I have a piece of C++ code with Rcpp and boost graph library, and am trying to<br>
| make a package with helps from Rcpp.package.skeleton() command.<br>
|<br>
| When I try to install the package with Rcmd INSTALL pkgname (I'm running on<br>
| windows machine), it seems that it is not recognizing the boost library by<br>
| displaying error messages that it is not recognizing the header files from<br>
| boost. I used the following Makevars.win file in the src directory:<br>
|<br>
| PKG_LIBS = $(shell ${R_HOME}/bin/Rscript.exe -e "Rcpp:::LdFlags()")<br>
| PKG_CPPFLAGS = -L "C:/Users/Won/Documents/Boost/boost_1_51/lib" -lboost_graph<br>
|<br>
| C:/Users/Won/Documents/Boost/boost_1_51/lib is the directory where the .dll<br>
| files live.<br>
| Would you be able to point me in the right direction? Is there something I've<br>
| done wrong in Makevars.win file?<br>
<br>
You added the _linker_ arguments to the _header_ flag. That is wrong: -L/-l<br>
belong to PKG_LIBS.<br>
<br>
Try in the src/ directory to decompose the steps into<br>
<br>
R CMD COMPILE mylib.dll *.cpp<br>
<br>
and<br>
<br>
R CMD SHLIB mylib.dll<br>
<br>
(or some other name for mylib) to see that you can a) compile (does g++ find<br>
headers) and b) link (does g++ find the dll).<br>
<br>
Dirk<br>
<br>
|<br>
| Any comments would be greatly appreciated.<br>
|<br>
| Thanks,<br>
|<br>
| ----------------------------------------------------------------------<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</div></div></blockquote></div><br></div><div><br></div>