[Rcpp-devel] RcppArmadillo error

Dirk Eddelbuettel edd at debian.org
Fri Mar 26 13:17:13 CET 2010

(resending, this time to list I omitted last time, sorry. --Dirk)

On 26 March 2010 at 11:10, Abhisek wrote:
| Hi,
| Ive been trying to make RcppArmadillo work using the example file (fastLM).
| I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to use
| fastLM but to figure out how to work RcppArmadillo).  Then i tried using the
| command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that
| RcppArmadillo.h not found.
| So i tried doing a symbolic link from /usr/local/include to the directory
| where RcppArmadillo.h and RcppArmadilloDefines.h is stored.  I also did a
| symbolic link analogously for RcppArmadillo.so.  When i ran R CMD SHLIB
| again I got the following error:
| abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp
| g++ -I/usr/share/R/include
| -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic  -g -O2 -c
| RcppArmadilloEg.cpp -o RcppArmadilloEg.o

So far so good:  one -I for R as usual, one for Rcpp.  

| In file included from
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215,
|                  from
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28,
|                  from RcppArmadilloEg.cpp:1:
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:
| In function ‘SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const
| T&, Rcpp::traits::false_type) [with T = arma::Col<double>]’:
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491:
| instantiated from ‘SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&,
| Rcpp::traits::false_type) [with T = arma::Col<double>]’
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509:
| instantiated from ‘SEXPREC*
| Rcpp::internal::wrap_dispatch_unknown_importable(const T&,
| Rcpp::traits::false_type) [with T = arma::Col<double>]’
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526:
| instantiated from ‘SEXPREC* Rcpp::internal::wrap_dispatch(const T&,
| Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]’
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541:
| instantiated from ‘SEXPREC* Rcpp::wrap(const T&) [with T =
| arma::Col<double>]’
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54:
| instantiated from ‘Rcpp::Named::Named(const std::string&, const T&) [with T
| = arma::colvec]’
| RcppArmadilloEg.cpp:19:   instantiated from here
| /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394:
| error: cannot convert ‘const arma::Col<double>’ to ‘SEXPREC*’ in
| initialization
| make: *** [RcppArmadilloEg.o] Error 1
| could someone provide some advice?

Which Rcpp version do you have installed?  

Which Armadillo version do you have installed?

I have not tried the free-floating direct compile you try here.  Maybe the
defines for RcppArmadillo that we use are missing here -- hard to say.
Could you try to create your own little package but copying the RcppArmadillo
files, changes DESCRIPTION to what you do and changes the FastLM code in C++
and R?


  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!

More information about the Rcpp-devel mailing list