<font face="arial,helvetica,sans-serif">Hi Charles,</font><div><font face="arial,helvetica,sans-serif"><br></font></div><div><font face="arial,helvetica,sans-serif">I believe the problem is that the Rcpp package is installed in a directory with spaces in the path (C:/Program Files/R/R-2.15.1/library/) and that this is causing the problem. If you install into a library without spaces in the path everything should work correctly (see: </font><font face="arial, helvetica, sans-serif"><a href="http://stackoverflow.com/questions/9764495/how-to-get-rcpp-to-work-in-r-on-a-windows-xp-platform">http://stackoverflow.com/questions/9764495/how-to-get-rcpp-to-work-in-r-on-a-windows-xp-platform</a>)</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial,helvetica,sans-serif">J.J.<br></font><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 6:11 AM, Charles Cara <span dir="ltr"><<a href="mailto:CharlesC@absolute-strategy.com" target="_blank">CharlesC@absolute-strategy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal">I have been trying to experiment with Rcpp as it looks like it could be an excellent tool. However, I am unable to get your Finding Pi example (<a href="http://dirk.eddelbuettel.com/blog/2012/11/20/#rcpp_attributes_pi_example" target="_blank">http://dirk.eddelbuettel.com/blog/2012/11/20/#rcpp_attributes_pi_example</a> ) to work.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I have the C++ file and the R script, but sourceCpp fails.  When I set showOutput and verbose to be TRUE then I get the following message.  Looking through the message, it appears that the g++ command line does not have one of the parameters in quotes (highlighted in green) which is why it might be interpreted as two (missing) parameters.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">It is beyond my limited knowledge whether this is a bug or a problem with the configuration of my system, details of which are attached.<u></u><u></u></p><p class="MsoNormal">
<u></u> <u></u></p><p class="MsoNormal">If you have any suggestions on how to fix this, so that I can go on and use Rcpp, then I would be grateful.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">
Best regards<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Charles Cara<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:blue;background:#e1e2e5">sourceCpp("src/piSugar.cpp", showOutput=TRUE, verbose=TRUE)<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">Generated extern "C" functions <u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">--------------------------------------------------------<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">#include <Rcpp.h><u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span lang="FR" style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">RcppExport SEXP sourceCpp_49731_piSugar(SEXP NSEXP) {<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">BEGIN_RCPP<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">    Rcpp::RNGScope __rngScope;<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">    int N = Rcpp::as<int >(NSEXP);<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">    double __result = piSugar(N);<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">    return Rcpp::wrap(__result);<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">END_RCPP<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">}<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">Generated R functions <u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">-------------------------------------------------------<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">`.sourceCpp_49731_DLLInfo` <- dyn.load('C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8276073a/sourceCpp_69065.dll')<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">piSugar <- Rcpp:::sourceCppFunction(function(N) {}, `.sourceCpp_49731_DLLInfo`, 'sourceCpp_49731_piSugar')<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">rm(`.sourceCpp_49731_DLLInfo`)<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">Building shared library<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">--------------------------------------------------------<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">DIR: C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8276073a<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">C:/PROGRA~1/R/R-215~1.1/bin/i386/R CMD SHLIB -o "sourceCpp_69065.dll" "piSugar.cpp" <u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">g++  -I"C:/PROGRA~1/R/R-215~1.1/include" -DNDEBUG     -I"C:/Program Files/R/R-2.15.1/library/Rcpp/include" -I"H:/Quantitative Strategy/R Working folder/3rd party examples/Rcpp and Pi/src"  -I"C:/Program Files/R/R-2.15.1/library/Rcpp/include" -I"H:/Quantitative Strategy/R Working folder/3rd party examples/Rcpp and Pi/src/../inst/include"      -O2 -Wall  -mtune=core2 -c piSugar.cpp -o piSugar.o<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">g++ -shared -s -static-libgcc -o sourceCpp_69065.dll tmp.def piSugar.o </span><span style="font-size:10.0pt;font-family:"Lucida Console";color:#00b050;background:#e1e2e5">C:/Program Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a</span><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""> -LC:/PROGRA~1/R/R-215~1.1/bin/i386 -lR<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">g++.exe: error: C:/Program: No such file or directory<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console"">g++.exe: error: Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a: No such file or directory<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">Error in inDL(x, as.logical(local), as.logical(now), ...) : <u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt">
<span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">  unable to load shared object 'C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8276073a/sourceCpp_69065.dll':<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Lucida Console";color:#c5060b;background:#e1e2e5">  LoadLibrary failure:  The specified module could not be found.</span><span style="background:#e1e2e5;font-size:10.0pt;font-family:"Lucida Console""><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif""> </span><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:gray">Charles Cara<br>Absolute Strategy Research Ltd.<br>1st Floor<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:gray">1-2 Royal Exchange Buildings,<br>London, EC3V 3LF<br><br><a href="tel:%2B44%20207-073-0738" value="+442070730738" target="_blank">+44 207-073-0738</a> (direct line)<br>
<a href="tel:%2B44%20207-073-0732" value="+442070730732" target="_blank">+44 207-073-0732</a> (fax)</span><span style="color:gray"> <br></span><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:gray">--------------------------------------------------<br>
</span><span style="font-size:7.5pt;font-family:"Tahoma","sans-serif";color:gray">Absolute Strategy Research Ltd is authorised and regulated by the Financial Services Authority.  This email may contain confidential information intended only for use of the individual(s) named on this e-mail. If you are not the intended recipient, or responsible for delivery of the message to that person, you may not copy, disclose, or take any action in reliance of the contents of this email. If you have received this message in error, please notify us by return email immediately and destroy this message. The information in this email is intended only for investors who are Market Counterparties or Professional Customers, as defined by the FSA, and may not be distributed to Private Customers.  Absolute Strategy Research Ltd does not solicit any action based upon this email, which is not to be construed as an invitation to buy or sell any security.  Unless specifically stated to the contrary in the main body of the text, this email is not intended to provide personal investment advice, nor to take into account the investment objectives, financial situation and the particular needs of any particular person who may read it. This email provides general information only. The information contained was obtained from sources that we believe to be reliable but we do not guarantee that it is accurate or complete, and it should not be relied upon as such. Opinions expressed are our current opinions as of the original publication date appearing on this material only and the information, including the opinions contained herein, are subject to change without notice.</span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p></div></div><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></blockquote></div><br></div>