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 ( http://dirk.eddelbuettel.com/blog/2012/11/20/#rcpp_attributes_pi_example ) to work.
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. 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. If you have any suggestions on how to fix this, so that I can go on and use Rcpp, then I would be grateful. Best regards Charles Cara sourceCpp("src/piSugar.cpp", showOutput=TRUE, verbose=TRUE) Generated extern "C" functions -------------------------------------------------------- #include <Rcpp.h> RcppExport SEXP sourceCpp_49731_piSugar(SEXP NSEXP) { BEGIN_RCPP Rcpp::RNGScope __rngScope; int N = Rcpp::as<int >(NSEXP); double __result = piSugar(N); return Rcpp::wrap(__result); END_RCPP } Generated R functions ------------------------------------------------------- `.sourceCpp_49731_DLLInfo` <- dyn.load('C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8 276073a/sourceCpp_69065.dll') piSugar <- Rcpp:::sourceCppFunction(function(N) {}, `.sourceCpp_49731_DLLInfo`, 'sourceCpp_49731_piSugar') rm(`.sourceCpp_49731_DLLInfo`) Building shared library -------------------------------------------------------- DIR: C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8276073a C:/PROGRA~1/R/R-215~1.1/bin/i386/R CMD SHLIB -o "sourceCpp_69065.dll" "piSugar.cpp" 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 g++ -shared -s -static-libgcc -o sourceCpp_69065.dll tmp.def piSugar.o C:/Program Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a -LC:/PROGRA~1/R/R-215~1.1/bin/i386 -lR g++.exe: error: C:/Program: No such file or directory g++.exe: error: Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a: No such file or directory Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/charlesc/AppData/Local/Temp/RtmpO2NWdT/sourcecpp_16e8276073a/s ourceCpp_69065.dll': LoadLibrary failure: The specified module could not be found. Charles Cara Absolute Strategy Research Ltd. 1st Floor 1-2 Royal Exchange Buildings, London, EC3V 3LF +44 207-073-0738 (direct line) +44 207-073-0732 (fax) -------------------------------------------------- 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.
[1] "0.97.248" $R [1] "C:\\PROGRA~1\\R\\R-215~1.1\\bin\\i386\\R.exe" $pdflatex [1] "" $bibtex [1] "" $gcc [1] "" $git [1] "C:\\PROGRA~1\\Git\\cmd\\git.exe" $svn [1] "" R version 2.15.1 (2012-06-22) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=C LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252 attached base packages: [1] datasets splines grDevices grid stats graphics utils methods base other attached packages: [1] rbenchmark_1.0.0 Rcpp_0.10.2 XLConnect_0.2-0 XLConnectJars_0.2-0 [5] rJava_0.9-3 caTools_1.13 bitops_1.0-4.1 Hmisc_3.9-3 [9] survival_2.36-14 Datastream2R_1.0 scales_0.2.1 ggplot2_0.9.1 [13] cairoDevice_2.19 XMLSchema_0.7-0 XML_3.9-4.1 reshape2_1.2.1 [17] reshape_0.8.4 plyr_1.7.1 latticeExtra_0.6-19 lattice_0.20-6 [21] RColorBrewer_1.0-5 PerformanceAnalytics_1.0.4.4 quantmod_0.3-17 TTR_0.21-1 [25] xts_0.8-6 zoo_1.7-7 Defaults_1.1-1 sp_0.9-99 [29] SSOAP_0.9-1 loaded via a namespace (and not attached): [1] cluster_1.14.2 codetools_0.2-8 colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2 labeling_0.1 MASS_7.3-19 [8] memoise_0.1 munsell_0.3 proto_0.3-9.2 RCurl_1.91-1.1 rstudio_0.97.248 stringr_0.6.1 tools_2.15.1 SysInfo: sysname release version nodename "Windows" "7" "build 7601, Service Pack 1" "PCASR131" machine login user effective_user "x86" "CharlesC" "CharlesC" "CharlesC" R Version: _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 15.1 year 2012 month 06 day 22 svn rev 59607 language R version.string R version 2.15.1 (2012-06-22) nickname Roasted Marshmallows $ALLUSERSPROFILE [1] "C:\\ProgramData" $AMDAPPSDKROOT [1] "C:\\Program Files\\AMD APP\\" $APPDATA [1] "C:\\Users\\charlesc\\AppData\\Roaming" $asl.log [1] "Destination=file" $BURN_AUTOPLAY [1] "C:\\Program Files\\Roxio\\OEM\\Roxio Burn\\" $CLASSPATH [1] ".;C:\\Program Files\\Java\\jre6\\lib\\ext\\QTJava.zip" $CommonProgramFiles [1] "C:\\Program Files\\Common Files" $COMPUTERNAME [1] "PCASR131" $ComSpec [1] "C:\\Windows\\system32\\cmd.exe" $DISPLAY [1] ":0" $EMC_AUTOPLAY [1] "C:\\Program Files\\Common Files\\Roxio Shared\\OEM\\" $ENV_DFOADDIN_SETUP_PATH [1] "C:\\Program Files\\Datastream\\Datastream DFO Add-In\\" $ENV_ICADDIN_SETUP_PATH [1] "C:\\Program Files\\Datastream\\Datastream Charting Add-In\\" $FP_NO_HOST_CHECK [1] "NO" $GFORTRAN_STDERR_UNIT [1] "-1" $GFORTRAN_STDOUT_UNIT [1] "-1" $HOME [1] "H:/Quantitative Strategy/R Working folder" $HOMEDRIVE [1] "P:" $HOMEPATH [1] "\\" $HOMESHARE [1] "\\\\SBS\\PersonalF\\CharlesC" $JAVA_HOME [1] "C:\\Program Files\\Java\\jre6" $LOCALAPPDATA [1] "C:\\Users\\charlesc\\AppData\\Local" $LOGONSERVER [1] "\\\\SBS" $NOAWT [1] "1" $NUMBER_OF_PROCESSORS [1] "4" $OS [1] "Windows_NT" $PATH [1] "C:\\Program Files\\R\\R-2.15.1\\bin\\i386;C:\\Program Files\\AMD APP\\bin\\x86;c:\\program files\\graphicsmagick-1.3.17-q8;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Services\\IPT\\;C:\\Program Files\\NTRU Cryptosystems\\NTRU TCG Software Stack\\bin\\;C:\\Program Files\\Dell\\Dell Data Protection\\Access\\Advanced\\Wave\\Gemalto\\Access Client\\v5\\;C:\\Program Files\\Windows Live\\Shared;C:\\Program Files\\Common Files\\Roxio Shared\\DLLShared\\;C:\\Program Files\\Common Files\\Roxio Shared\\OEM\\DLLShared\\;C:\\Program Files\\Common Files\\Roxio Shared\\OEM\\DLLShared\\;C:\\Program Files\\Common Files\\Roxio Shared\\OEM\\12.0\\DLLShared\\;C:\\Program Files\\Roxio\\OEM\\AudioCore\\;C:\\Program Files\\ATI Technologies\\ATI.ACE\\Core-Static;c:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\;c:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\;C:\\Program Files\\Calibre2\\;C:\\Program Files\\R\\R-2.15.1\\bin;C:\\python27;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\QuickTime\\QTSystem\\" $PATHEXT [1] ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" $PROCESSOR_ARCHITECTURE [1] "x86" $PROCESSOR_IDENTIFIER [1] "x86 Family 6 Model 42 Stepping 7, GenuineIntel" $PROCESSOR_LEVEL [1] "6" $PROCESSOR_REVISION [1] "2a07" $ProgramData [1] "C:\\ProgramData" $ProgramFiles [1] "C:\\Program Files" $PSModulePath [1] "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\" $PUBLIC [1] "C:\\Users\\Public" $QTJAVA [1] "C:\\Program Files\\Java\\jre6\\lib\\ext\\QTJava.zip" $R_ARCH [1] "/i386" $R_DOC_DIR [1] "C:/PROGRA~1/R/R-215~1.1/doc" $R_HOME [1] "C:/PROGRA~1/R/R-215~1.1" $R_LIBS [1] "C:/Program Files/RStudio/R/library" $R_LIBS_USER [1] "H:/Quantitative Strategy/R Working folder/R/win-library/2.15" $R_USER [1] "H:/Quantitative Strategy/R Working folder" $RCAUTOPLAY [1] "C:\\Program Files\\Roxio\\OEM\\Roxio Central 5\\" $RS_RPOSTBACK_PATH [1] "C:/Program Files/RStudio/bin/rpostback" $RSTUDIO [1] "1" $RSTUDIO_SESSION_PORT [1] "34596" $RSTUDIO_USER_IDENTITY [1] "CharlesC" $SESSIONNAME [1] "Console" $SSH_AGENT_PID [1] "2292" $SSH_AUTH_SOCK [1] "/tmp/ssh-BkfTyx2304/agent.2304" $SystemDrive [1] "C:" $SystemRoot [1] "C:\\Windows" $TEMP [1] "C:\\Users\\charlesc\\AppData\\Local\\Temp" $TMP [1] "C:\\Users\\charlesc\\AppData\\Local\\Temp" $USERDNSDOMAIN [1] "ABSOLUTESTRATEGY.LOCAL" $USERDOMAIN [1] "ABSOLUTE" $USERNAME [1] "CharlesC" $USERPROFILE [1] "C:\\Users\\charlesc" $VS100COMNTOOLS [1] "c:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\Tools\\" $windir [1] "C:\\Windows" $windows_tracing_flags [1] "3" $windows_tracing_logfile [1] "C:\\BVTBin\\Tests\\installpackage\\csilogfile.log" [1] ".GlobalEnv" "package:rbenchmark" "package:Rcpp" "tools:rstudio" [5] "package:datasets" "package:XLConnect" "package:XLConnectJars" "package:rJava" [9] "package:caTools" "package:bitops" "package:Hmisc" "package:survival" [13] "package:splines" "package:Datastream2R" "package:scales" "package:ggplot2" [17] "package:cairoDevice" "package:grDevices" "package:XMLSchema" "package:XML" [21] "package:reshape2" "package:reshape" "package:plyr" "package:grid" [25] "package:latticeExtra" "package:lattice" "package:RColorBrewer" "package:PerformanceAnalytics" [29] "package:quantmod" "package:TTR" "package:xts" "package:zoo" [33] "package:stats" "package:Defaults" "package:sp" "package:graphics" [37] "package:SSOAP" "package:utils" "package:methods" "Autoloads" [41] "package:base"
piSugar.cpp
Description: piSugar.cpp
Pi Example.R
Description: Pi Example.R
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel