Stack Exchange
convert Rcpp::NumericVector to Eigen::VectorXd
A similar question has been asked before, here:
Converting between NumericVector/Matrix and VectorXd/MatrixXd in Rcpp(Eigen) to perform Cholesky solve
The thing is, the code I found in fastLm.cpp (at the end) does not work for me. 
Rcpp::NumericVector X( (SEXP) R.parseEval("x <- 1:10"));

Eigen::Map<Eigen::VectorXd> XS(Rcpp::as<Eigen::Map<Eigen::VectorXd>>(X)); //!!not working

It gives the following error:
error: no matching constructor for initialization of 'Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >'
                    Exporter( SEXP x ) : t(x){}

and (besides others):
note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'SEXP' (aka 'SEXPREC *') to 'const Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >'
template<typename PlainObjectType, int MapOptions, typename StrideType> class Map

It might have something to do with the SEXP object?

It works for me if I add one more space between the >>:
R> cppFunction("bool conv(NumericVector X) { \
      Eigen::Map<Eigen::VectorXd> \
      XS(Rcpp::as<Eigen::Map<Eigen::VectorXd> >(X)); return true; } ", 
           depends="RcppEigen")
R> conv(1:4)
[1] TRUE
R>

Also, I don't think you can just say 
X((SEXP) R.parseEval("x <- 1:10"))

unless you use RInside, which has its own example for Eigen -- and for that just do
cd examples/eigen
make
./rinside_sample0
./rinside_sample1

Both still run as they should in my installation. 

Yes, I use RInside - forgot to mention it. I looked at rinside_eigen0 in examples/eigen. After I included RcppEigen it is working now. Thanks!

Not a problem per se, obviously, but "noise" in the context of your actual question.   So you it turns out you simply had RInside instrumented the wrong way -- it happens.
