[Rcpp-devel] rcpp 0.10 on mac error with sourceCpp

Dirk Eddelbuettel edd at debian.org
Thu Nov 15 19:34:41 CET 2012


On 15 November 2012 at 13:20, Jiqiang Guo wrote:
| I tried the example of sourceCpp on Mac mountain lion with R 2.15.1
| with the following error (I hit the similar error in using RStan as
| well).
| 
| > library(Rcpp)
| > require(Rcpp)
| >
| >      sourceCpp(code='

Operator error:  sourceCpp() takes a filename.  cppFunction() takes a
"program in a string" a la cxxfunction()

Dirk


| +        #include <Rcpp.h>
| +
| +        // [[Rcpp::export]]
| +        int fibonacci(const int x) {
| +          if (x == 0) return(0);
| +          if (x == 1) return(1);
| +          return (fibonacci(x - 1)) + fibonacci(x - 2);
| +        }'
| +      , verbose = TRUE)
| 
| Generated Rcpp module declaration:
| --------------------------------------------------------
| 
| RCPP_MODULE(sourceCpp_72196) {
|     Rcpp::function("fibonacci", &fibonacci,
| Rcpp::List::create(Rcpp::Named("x")));
| }
| 
| Building shared library
| --------------------------------------------------------
| 
| DIR: /var/folders/vs/tzgx0z_s0zvgg15pw84b93km0000gn/T//RtmpuSV7dx/sourcecpp_12a13a02b8d4
| 
| Error in tools:::file_path_as_absolute(base:::system.file(..., package
| = "Rcpp")) :
|   file '' does not exist
| > sessionInfo()
| R version 2.15.1 (2012-06-22)
| Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
| 
| locale:
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
| 
| attached base packages:
| [1] tools     stats     graphics  grDevices utils     datasets
| methods   base
| 
| other attached packages:
| [1] Rcpp_0.10.0
| 
| 
| ===
| Another place:
| 
| Error in tools:::file_path_as_absolute(base:::system.file(..., package
| = "Rcpp")) :
|   file '' does not exist
| Calls: stan_model ... <Anonymous> -> RcppLdPath -> Rcpp.system.file ->
| <Anonymous>
| Execution halted
| 
| --
| Jiqiang
| _______________________________________________
| 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