Captain
Captain

Reputation: 23

undefined reference to RcppArmadillo

I am new to Rcpp. I am seeking help with the following problem. It seems that the RcppArmadillo does not work. Could someone give me some suggestions? Many Thanks!

g++ -m64 -I"D:/R/R-32~1.5/include" -DNDEBUG -I"D:/R/R-3.2.5/library/Rcpp/include" -I"D:/R/R-3.2.5/library/RcppArmadillo/include" -I"D:/R/R-3.2.5/library/RcppProgress/include" -I"D:/R/Rcode/Replicating/src" -I"D:/R/Rcode/Replicating/inst/include" -I"d:/RCompile/r-compiling/local/local323/include" -O2 -Wall -mtune=core2 -c test.cpp -o test.o

In file included from D:/R/R-3.2.5/library/RcppProgress/include/progress.hpp:13:0, from test.cpp:7: D:/R/R-3.2.5/library/RcppProgress/include/interruptable_progress_monitor.hpp:101:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]

D:/R/R-3.2.5/library/RcppProgress/include/interruptable_progress_monitor.hpp:147:0: warning: ignoring #pragma omp atomic [-Wunknown-pragmas]

D:/R/R-3.2.5/library/RcppProgress/include/interruptable_progress_monitor.hpp:153:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]

g++ -m64 -shared -s -static-libgcc -o sourceCpp_7.dll tmp.def test.o -LD:/R/R-32~1.5/bin/x64 -lRlapack -LD:/R/R-32~1.5/bin/x64 -lRblas -lgfortran -Ld:/RCompile/r-compiling/local/local323/lib/x64 -Ld:/RCompile/r-compiling/local/local323/lib -LD:/R/R-32~1.5/bin/x64 -lR

test.o:test.cpp:(.text+0x61ee): undefined reference to `mvrnormArma(arma::Col, arma::Mat, int)'

test.o:test.cpp:(.text+0x6d0e): undefined reference to `mvrnormArma(arma::Col, arma::Mat, int)'

collect2: ld returned 1 exit status

Upvotes: 0

Views: 1039

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368241

That looks like a faily common and obvious error of having forgotten to update src/Makevars, and here src/Makevars.win, to contain

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) 

so that the required LAPACK and BLAS functionality is there.

For what it is worth, this also gets added automagically for you if you choose to start from RcppArmadillo.package.skeleton() as is generally recommended.

Upvotes: 9

Related Questions