Hi, all.  Another question as I embark on my first project that uses Rcpp.

Consider the following test code, that comes right off of the Using Matrices 
section of the Rcpp-quickref file on CRAN.

RcppExport int test() {

  Rcpp::NumericMatrix xx(3,2);
  int i;
  int xsize = xx.nrow() * xx.ncol();

  for (i = 0; i < xsize; i++) {
    xx[i] = 7;
  }

  Rcpp::NumericMatrix::Column z1 = xx( _,1);   // line 91
//  Rcpp::NumericVector z2 = xx(_,1); 

  return 0;

}


When I try to compile this code in g++, I get the following:

g++ -O0 -arch x86_64 -g -Wall -fopenmp 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64  
-I/usr/local/include 
-I/Library/Frameworks/R.framework/Resources/library/Rcpp/include -c 
Rcpp_omp.cpp -o Rcpp_omp.o
Rcpp_omp.cpp: In function ‘int test()’:
Rcpp_omp.cpp:91: error: ‘_’ was not declared in this scope
Rcpp_omp.cpp:91: warning: unused variable ‘z1’

and I get something similar if I comment out the z1 assignment instead of z2.  
I tried playing around with spacing around the underscore, to no avail.  This 
also happens with the Intel compiler, so I doubt it's that.

>From sessionInfo(), I confirmed that I have Rcpp 0.9.2 installed.

It seems like I am doing *exactly* what is in the documentation.  Am I missing 
something?

Thanks,

Michael



-------------------------------------------
Michael Braun
Homer A. Burnell (1928) Career Development Professor, 
        and Assistant Professor of Management Science (Marketing Group)
MIT Sloan School of Management
100 Main St.., E62-535
Cambridge, MA 02139
bra...@mit.edu
617-253-3436


_______________________________________________
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

Reply via email to