Rcpp编译的属性不可用于调用
Rcpp compiled Attributes not available for call
首先我知道这可能是一个Rcpp-Devel函数,但当我尝试使用Firefox或Chrome订阅时,我在工作以太网中遇到一个错误,即连接不安全,所以我现在必须在这里询问。
所以我买了德克的书,它写得很好。
我在这里遇到了类似的错误https://www.mail-archive.com/rcpp-devel%40lists.r-伪造.r-project.org/msg08059.html
Sage<-testArm(set,labels,contrast,geneSets,var.equal=FALSE)
Calculating comparisons...Error in .Call("sigmaCalc", PACKAGE = "mySage") :
"sigmaCalc" not available for .Call() for package "mySage"
注意,我的NameSpace有useDynLib(mySage),我可以成功地运行compileAttributes和R CMD构建(在外部目录中)并成功安装包。
当我尝试调用RcppExport.R函数时,我会生成错误
这是我的一个Cpp代码
//[[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
#include <algorithm>
#include <vector>
#include <Rcpp.h>
#include <math.h>
#include <R.h>
using namespace arma;
using namespace Rcpp;
//'calculates the sd and mindof in order , names are assigned in R, as of now, there is no NA error checking. not very robust
//' @param SDs standard deviations from geneResults returned by makeComparison
//' @param DOFs degrees of freedom from geneResults returned by makeComparison
//' @param geneSets a set of genes for enrichment testing
//' @export
//' @return a List with SumSigma and MinDof
//[[Rcpp::export]]
List sigmaCalc( SEXP SDs, SEXP DOFs, SEXP geneSets) {
Rcpp::NumericVector SD(SDs);
Rcpp::NumericVector DOF(DOFs);
Rcpp::List geneSet(geneSets);
more code ....
此处的注释已创建并正确导出到R名称空间这是RcppExports.R
# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#'calculates the sd and mindof in order , names are assigned in R, as of now, there is no NA error checking. not very robust
#' @param SDs standard deviations from geneResults returned by makeComparison
#' @param DOFs degrees of freedom from geneResults returned by makeComparison
#' @param geneSets a set of genes for enrichment testing
#' @export
#' @return a List with SumSigma and MinDof
sigmaCalc <- function(SDs, DOFs, geneSets) {
.Call('mySage_sigmaCalc', PACKAGE = 'mySage', SDs, DOFs, geneSets)
}
这是RcppExport.cpp
// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#include <RcppArmadillo.h>
#include <Rcpp.h>
using namespace Rcpp;
// sigmaCalc
List sigmaCalc(SEXP SDs, SEXP DOFs, SEXP geneSets);
RcppExport SEXP mySage_sigmaCalc(SEXP SDsSEXP, SEXP DOFsSEXP, SEXP geneSetsSEXP) {
BEGIN_RCPP
Rcpp::RObject __result;
Rcpp::RNGScope __rngScope;
Rcpp::traits::input_parameter< SEXP >::type SDs(SDsSEXP);
Rcpp::traits::input_parameter< SEXP >::type DOFs(DOFsSEXP);
Rcpp::traits::input_parameter< SEXP >::type geneSets(geneSetsSEXP);
__result = Rcpp::wrap(sigmaCalc(SDs, DOFs, geneSets));
return __result;
END_RCPP
}
我不确定有几件事,需要头文件吗?文本建议需要rcpp_hello_world.h,但是在阅读RcppExport.cpp之后,cpp函数声明包含在Export.cpp中,所以我不确定是否需要编写声明性头文件。另外networkBMA、wordcloud和pcaMethods都是Rcpp包,它们不包括头,那么头只用于连接API吗?
另一个可能导致此错误的原因是,我的函数参数是SEXP对象,而不是Rcpp:NumericVectors/NumericMatrix,我应该编写cpp代码sigmaCalc来输入Rcpp类型,然后确保Export.cpp函数处理SEXP强制转换吗?
谢谢。
附言:这是我在src/中的Makevars
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
PKG_CXXFLAGS=`$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"`
我认为错误是我输入了SEXP作为cpp函数的输入,这只有在原型化sourceCpp从C++到R时才需要,在打包时,RcppExports.cpp是两个系统之间的中介。
这篇文章很长,很难看到结构。我建议你重新开始,做中的任何一个
- 致电
Rcpp.package.skeleton()
并研究该软件包,或者 - 使用RStudio为您创建包,或者
- 使用类似RcppExamples的示例包
从这些开始,重建它们。然后慢慢添加您的函数,运行compileAttributes()
并重建/重新安装。
- Arduino SocketIoClient - 没有用于调用的匹配函数
- Rcpp并行无匹配函数,用于调用"转换"
- 没有用于调用默认构造函数的匹配函数
- 我正在尝试学习如何在 c++ 中传递指针,但出现错误:没有用于调用"test"的匹配函数。我做错了什么?
- c++\CLI dll包装器,用于调用c++类中的虚拟成员
- 尝试在 std::map 中插入抽象类时没有用于调用的匹配函数
- 没有用于调用 foo 的匹配函数
- qt并发没有用于调用"运行"的匹配函数
- C++天鹅座的错误;没有用于调用"std::basic_fstream..."的匹配函数
- Lambda 函数,用于调用有权访问类成员的成员函数
- 没有用于调用 GetLine() 的匹配函数
- 类模板"没有用于调用播放器的匹配函数::P layer()"
- 模板调用函数错误 - 没有用于调用'bubbleSort'的匹配函数
- 如何在 C++14 中编写用于调用 Fortran 函数的通用包装器(按引用调用 --按值调用>)
- TCP - C++ - 没有用于调用的匹配函数
- 没有用于调用错误的匹配函数.将字符串推送到向量中
- C++在使用模板时没有用于调用的匹配函数,链接器错误
- Customplaceholder没有用于调用QT标签的匹配函数
- 没有用于调用 conv(犰狳库)的匹配函数
- C++ 多态错误:没有用于调用的匹配函数