I am a beginner of Rcpp. I encountered many difficulties in creating an R package(BSMHM2) for the Rcpp function. Before giving the error information, I quickly introduced what I have down as below.
I wrote several functions with .cpp file (like f_Bbeta.cpp, f_order.cpp and f_mmult.cpp). These functions were used in the main function (mcmc.cpp) and I put them all in \src. Specifically, in f_order.cpp, f_mvnorm and f_wishart, I included the RcppArmadillo.h while RcppEigen.h was included in f_mmult.cpp. Some cpp files, such as f_beta.cpp, will call the function f_mmult and f_mvnorm.
When I use R CMD check BSMHM2, it seems that I have two types of error. The first was like this form:
g++ -m32 -I"C:/PROGRA~1/R/R-32~1.2/include" -DNDEBUG -I"C:/Program Files/R/R-3.2.2/library/Rcpp/include" -I"C:/Program Files/R/R-3.2.2/library/RcppArmadillo/include" -I"C:/Program Files/R/R-3.2.2/library/RcppEigen/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -mtune=core2 -c f_Bbeta.cpp -o f_Bbeta.o
Another type of error was like f_wishart.o:f_wishart.cpp:(.text+0xc93): undefined reference to `dpotrf_'
It will be so grateful if any experts in Rcpp could help to solve this problem. Thank you!