[R] Rcpp segmentation faults on the simplest code

didu ye.patrick at gmail.com
Thu Apr 14 12:56:48 CEST 2011

Hi all,

I'm new to R and Rcpp, and I'm trying to learn Rcpp with the simplest code
possible. My goal is to be able to call R functions from C++.

The code I'm trying to run is:


int main(int argc, char* argv[])
	Rcpp::NumericVector v(1);
	return 0;

It compiles and links fine. However, as soon as I run it, it segfaults. The
following is the gdb trace:

<co(gdb) run
Starting program: /home/jingy/tmp/stl 
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabb86d70 in ?? () from /usr/lib/libR.so
(gdb) up
#1  0x00002aaaabb8849b in Rf_allocVector () from /usr/lib/libR.so
#2  0x0000000000401618 in Vector (this=0x7fffffffd880, size=@0x7fffffffd89c)
at /usr/local/lib/R/site-library/Rcpp/include/Rcpp/vector/Vector.h:130
130	    	RObject::setSEXP( Rf_allocVector( RTYPE, size) ) ;
#3  0x0000000000401438 in main (argc=1, argv=0x7fffffffd998) at stl.cpp:8
8		Rcpp::NumericVector v(1);
Initial frame selected; you cannot go up.de>

I installed the following R packages using "dpkg -i" on my Ubuntu 9.04 amd
64 OS:


i installed Rcpp_0.9.4.tar.gz using the command:

R CMD INSTALL Rcpp_0.9.4.tar.gz

Any help would be greatly appreciated.

Thanks a lot.


View this message in context: http://r.789695.n4.nabble.com/Rcpp-segmentation-faults-on-the-simplest-code-tp3449290p3449290.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list