[Rcpp-devel] Rcpp: Error 1 occurred building shared library ?

Jian Zhang jzhang1982 at gmail.com
Sun Dec 2 17:48:08 CET 2012


Hey, everyone.

I am trying to learn the Rcpp by the example “Rcpp attributes: A simple example 'making pi' ” (http://dirk.eddelbuettel.com/blog/2012/11/20/) now, but the following error occurs when loading the .cpp file into R:

> sourceCpp("C:\\Users\\Jian\\Desktop\\piSugar.cpp")
Error in sourceCpp("C:\\Users\\Jian\\Desktop\\piSugar.cpp") : 
Error 1 occurred building shared library.

"piSugar.cpp”#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
double piSugar(const int N) {
    RNGScope scope;		// ensure RNG gets set/reset
    NumericVector x = runif(N);
    NumericVector y = runif(N);
    NumericVector d = sqrt(x*x + y*y);
    return 4.0 * sum(d < 1.0) / N;
}
Does anyone know what this error comes from? Is it related to what operating system I use? I am using the Windows 7 (64 bit) system.

Thanks so much.


Jian




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121202/a4cbd865/attachment.html>


More information about the Rcpp-devel mailing list