That&#39;s true - I was a bit sloppy copying the lines. Forget the first one, so<div><br></div><div><span class="Apple-style-span" style="color: rgb(80, 0, 80); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">PKG_LIBS+= -lRcpp<br>
PKG_LIBS+= -LC:/PROGRA~1/R/R-213~1.1/</span><span class="Apple-style-span" style="color: rgb(80, 0, 80); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">library/Rcpp/libs/i386<br></span></div>
<div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif">is all you need.</font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><br>
</font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif">BR,</font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif">Bjørn</font></div><div><font class="Apple-style-span" color="#500050" face="arial, sans-serif"><br>
</font><div class="gmail_quote">2011/9/8 Dirk Eddelbuettel <span dir="ltr">&lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On 8 September 2011 at 15:11, Bjørn Skogtrø wrote:<br>
| Hi Dirk,<br>
|<br>
| Thanks for the response - it was helpful. <br>
<br>
</div>Glad to hear that!<br>
<div class="im"><br>
| I&#39;ve added the library you suggested and the appropriate path, and now linking<br>
| is fine. For completeness, my makevars.win now looks like this:<br>
|<br>
| ## Use the R_HOME indirection to support installations of multiple R version<br>
| ## PKG_LIBS = $(shell &quot;${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe&quot; -e<br>
| &quot;Rcpp:::LdFlags()&quot;)<br>
|<br>
| PKG_LIBS = $(&quot;C:/PROGRA~1/R/R-2.13.1/library/Rcpp/lib/i386/libR.cpp.a&quot;)<br>
| PKG_LIBS+= -lRcpp<br>
| PKG_LIBS+= -LC:/PROGRA~1/R/R-213~1.1/library/Rcpp/libs/i386<br>
<br>
</div>Isn&#39;t the first line a null op? What is it supposed to do?  Just the latter<br>
two are probably fine as well.<br>
<font color="#888888"><br>
Dirk<br>
</font><div><div></div><div class="h5"><br>
| Guess the approach can be prettified using the $(shell....) approach above and<br>
| regular expressions, but I&#39;m no expert on this.<br>
|<br>
| Thanks again!<br>
|<br>
| BR,<br>
| Bjørn<br>
|<br>
|<br>
|<br>
|<br>
| 2011/9/8 Dirk Eddelbuettel &lt;<a href="mailto:edd@debian.org">edd@debian.org</a>&gt;<br>
|<br>
|<br>
|     Hi Bjørn,<br>
|<br>
|     Welcome!<br>
|<br>
|     On 8 September 2011 at 10:36, Bjørn Skogtrø wrote:<br>
|     | Hi guys.<br>
|     |<br>
|     | First off, thanks for a nice piece of software.<br>
|     |<br>
|     | Now to the issue at hand:<br>
|     |<br>
|     | I&#39;m trying to compile and link the package obtained using<br>
|     Rcpp.package.skeleton<br>
|     | (...) (out of the box). I&#39;m running R 2.13.1, with Rcpp 0.9.6 on a<br>
|     Windows XP<br>
|     | machine. <br>
|     |<br>
|     | The first problem I ran into was how the package-libs variable PKG_LIBS<br>
|     was<br>
|     | pasted into the g++ string for compiling:<br>
|     |<br>
|     | g++ -shared -s -static-libgcc -o processes.dll tmp.def rcpp_hello_world.o<br>
|     | rcpp_module.o C:/Program Files/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a<br>
|     -LC:/<br>
|     | PROGRA~1/R/R-213~1.1/bin/i386 -lR<br>
|     | g++.exe: C:/Program: No such file or directory<br>
|     | g++.exe: Files/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a: No such file<br>
|     or<br>
|     | directory<br>
|     | ERROR: compilation failed for package &#39;processes&#39;<br>
|     | * removing &#39;D:/Documents/Eclipse/processes.Rcheck/processes&#39;<br>
|     |<br>
|     | As you can see, paths with spaces in them is not cool.<br>
|<br>
|     Correct. The shell / Makefile quoting gets in the way.<br>
|<br>
|     If someone comes with _reliable ways to improve this_ we&#39;d be open for<br>
|     patches. Until then the recommendation is to not use directories with<br>
|     spaces.<br>
|<br>
|     | I resolved this by overriding it in makevars.win by hard-coding it, so my<br>
|     makevars.win looks like<br>
|<br>
|     Good idea.<br>
|<br>
|     | ## Use the R_HOME indirection to support installations of multiple R<br>
|     version<br>
|     | ## PKG_LIBS = $(shell &quot;${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe&quot; -e<br>
|     | &quot;Rcpp:::LdFlags()&quot;)<br>
|     | PKG_LIBS = $(&quot;C:/PROGRA~1/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a&quot;)<br>
|     |<br>
|     | Compiling then works fine, and spits out the files rcpp_module.o and<br>
|     | rcpp_hello_world.o. The problem then is linking, which complains over<br>
|     | &quot;undefined reference&quot;:<br>
|     |<br>
|     | * installing *source* package &#39;processes&#39; ...<br>
|     | ** libs<br>
|     | cygwin warning:<br>
|     |   MS-DOS style path detected: C:/PROGRA~1/R/R-213~1.1/etc/i386/Makeconf<br>
|     |   Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-213~1.1/etc/<br>
|     i386/<br>
|     | Makeconf<br>
|     |   CYGWIN environment variable option &quot;nodosfilewarning&quot; turns off this<br>
|     | warning.<br>
|     |   Consult the user&#39;s guide for more details about POSIX paths:<br>
|     |     <a href="http://cygwin.com/cygwin-ug-net/using.html#using-pathnames" target="_blank">http://cygwin.com/cygwin-ug-net/using.html#using-pathnames</a><br>
|     | g++ -shared -s -static-libgcc -o processes.dll tmp.def rcpp_hello_world.o<br>
|     | rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lR<br>
|     | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x66): undefined reference<br>
|     to<br>
|     | `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
|     | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x71): undefined reference<br>
|     to<br>
|     | `void Rcpp::internal::r_init_vector&lt;16&gt;(SEXPREC*)&#39;<br>
|     | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x148): undefined<br>
|     reference to<br>
|     | `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
|     | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x1a7): undefined<br>
|     reference to<br>
|     | `Rcpp::RObject::setSEXP(SEXPREC*)&#39;<br>
|     |<br>
|     | I&#39;m assuming that these two errors are somewhat related, but can&#39;t figure<br>
|     it<br>
|     | out (the compile processs running R CMD check is a bit intransparent to<br>
|     me). I<br>
|     | should mention that this exact procedure worked fine until I upgraded<br>
|     from<br>
|     | 2.13.0 to 2.13.1 yesterday.<br>
|     |<br>
|     | Any clues on what to look at??<br>
|<br>
|     Your PKG_LIBS appears to be wrong:<br>
|<br>
|       g++ -shared -s -static-libgcc -o processes.dll tmp.def<br>
|     rcpp_hello_world.o<br>
|            rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lR<br>
|<br>
|     You need a -L part for a location, as well as -l part giving a library, eg<br>
|<br>
|       g++ -shared -s -static-libgcc -o processes.dll tmp.def<br>
|     rcpp_hello_world.o<br>
|            rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lRcpp -lR<br>
|<br>
|     where I added -lRcpp.<br>
|<br>
|     Hope this helps,  Dirk<br>
|<br>
|     | Thanks!<br>
|     |<br>
|     | BR,<br>
|     | Bjørn<br>
|     |<br>
|     |<br>
|     | --<br>
|     | Up, down, turn around<br>
|     | Please dont let me hit the ground<br>
|     | Tonight I think Ill walk alone<br>
|     | Ill find my soul as I go home.<br>
|     |<br>
|     | ----------------------------------------------------------------------<br>
|     | _______________________________________________<br>
|     | Rcpp-devel mailing list<br>
|     | <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">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>
|     Two new Rcpp master classes for R and C++ integration scheduled for<br>
|     New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
|     <a href="http://dirk.eddelbuettel.com/blog/2011/08/04#" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#</a><br>
|     rcpp_classes_2011-09_and_2011-10<br>
|     <a href="http://www.revolutionanalytics.com/products/training/public/" target="_blank">http://www.revolutionanalytics.com/products/training/public/</a><br>
|     rcpp-master-class.php<br>
|<br>
|<br>
|<br>
|<br>
| --<br>
| Up, down, turn around<br>
| Please dont let me hit the ground<br>
| Tonight I think Ill walk alone<br>
| Ill find my soul as I go home.<br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">Two new Rcpp master classes for R and C++ integration scheduled for<br>
New York (Sep 24) and San Francisco (Oct 8), more details are at<br>
<a href="http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10" target="_blank">http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10</a><br>
<a href="http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php" target="_blank">http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Up, down, turn around<br>Please dont let me hit the ground<br>Tonight I think Ill walk alone<br>Ill find my soul as I go home.<br>
</div>