我一直在不停地构建用于住宅的R包。它使用Rcpp和C ++中定义的一堆函数。我得到了一个错误,并说有两个函数的未定义引用。两者都是内联函数
我尝试注释掉RcppExports中的功能,但是每次运行都会重新生成代码。我不确定该做什么。
'''R包构建
==> Rcpp::compileAttributes()
* Updated src/RcppExports.cpp
* Updated R/RcppExports.R
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source PHit
* installing to library 'C:/Users/kyle.m.joshi.NAE/Documents/R/win-library/3.6'
* installing *source* package 'PHit' ...
** using staged installation
** libs
c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG -I"C:/Users/kyle.m.joshi.NAE/Documents/R/win-library/3.6/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
make: Warning: File 'RcppExports.o' has modification time 135 s in the future
RcppExports.cpp:317:15: warning: inline function 'double mils2meters(double, double)' used but never defined
inline double mils2meters(double mils, double range);
^
RcppExports.cpp:353:15: warning: inline function 'double sqrtsumsq(double, double)' used but never defined
inline double sqrtsumsq(double a, double b);
^
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o PHit.dll tmp.def Phit.o RcppExports.o hcubature.o pcubature.o -LC:/PROGRA~1/R/R-36~1.0/bin/x64 -lR
RcppExports.o:RcppExports.cpp:(.text+0x2818): undefined reference to `mils2meters(double, double)'
RcppExports.o:RcppExports.cpp:(.text+0x35f8): undefined reference to `sqrtsumsq(double, double)'
collect2.exe: error: ld returned 1 exit status
make: warning: Clock skew detected. Your build may be incomplete.
no DLL was created
ERROR: compilation failed for package 'PHit'
* removing 'C:/Users/kyle.m.joshi.NAE/Documents/R/win-library/3.6/PHit'
* restoring previous 'C:/Users/kyle.m.joshi.NAE/Documents/R/win-library/3.6/PHit'
Exited with status 1.
'''
'''RcppExort.cpp示例函数
inline double mils2meters(double mils, double range);
RcppExport SEXP _PHit_mils2meters(SEXP milsSEXP, SEXP rangeSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< double >::type mils(milsSEXP);
Rcpp::traits::input_parameter< double >::type range(rangeSEXP);
rcpp_result_gen = Rcpp::wrap(mils2meters(mils, range));
return rcpp_result_gen;
END_RCPP
}
'''