我使用RcppArmadillo和内联包编写函数,我使用的是Windows 7,R-2.14.1和Rtools215,并检查路径。
funs = cxxfunction(list(MHcpp = signature(…), IWcpp = signature(…), c(code1,code2),
plugin="RcppArmadillo" ) # No compline and I they work fine as expected.
Package.skeleton(“new”,funs) # to create the package skeleton and the dynamic libray
# to build the package I use
R CMD INSTALL –build new # I get the following error
C:/Users/samuel/Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a(Dimension.o
):Dimension.cpp:(.text+0x342): undefined reference to `_Unwind_SjLj_Unregister'
…………………………………………………………..
…………………………………………………………….
C:/Users/samuel/Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a(Environment
.o):Environment.cpp:(.text$_ZN4Rcpp11no_such_envC1Ei[Rcpp::no_such_env::no_such_
env(int)]+0x3fc): undefined reference to `_Unwind_SjLj_Unregister'
C:/Users/samuel/Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a(Environment
.o):Environment.cpp:(.text$_ZN4Rcpp11no_such_envC1Ei[Rcpp::no_such_env::no_such_
env(int)]+0x644): undefined reference to `_Unwind_SjLj_Resume'
collect2: ld returned 1 exit status
ERROR: compilation failed for package 'new'
* removing 'C:/Users/samuel/Documents/R/win-library/2.14/new'
有关如何解决问题的任何建议。
答案 0 :(得分:2)
您需要使用Rcpp提供的package.skeleton
变体,或者在这种情况下,使用RcppArmadillo。也就是说,打电话
RcppArmadillo.package.skeleton(...)
不是来自基地R的那个。
您还可以查看依赖于RcppArmadillo的其他CRAN包是如何组织的,并比较差异。