xts-0.9-1 包提供的 xts_API for C 不能直接在 C++ 中使用。
例如,如果一个人写
#include <Rcpp.h>
extern "C" {
#include <xts.h>
}
using namespace Rcpp;
RcppExport SEXP get_xts_index(SEXP x, SEXP value) {
BEGIN_RCPP
return SET_xtsIndexClass(x, value);
END_RCPP
}
会出现以下编译时错误:
error: expected identifier before ‘)’ token
error: ‘install’ was not declared in this scope
error: ‘getAttrib’ was not declared in this scope
error: ‘setAttrib’ was not declared in this scope
error: ‘xts_IndexvalueSymbol’ was not declared in this scope
如何为 C 调用 xts_API?