RcppExports.o:RcppExports.cpp:(.rdata+0x720):对“VirFinder_countSeqFeatureCpp”的未定义引用

问题描述 投票:0回答:1

我正在使用 rstudio 并尝试使用 devtools::load_all() 来加载包,但是,我遇到了未定义的引用错误。

Error in (function (command = NULL, args = character(), error_on_status = TRUE,  : 
  System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> VF_cppfunction.cpp: In function 'std::vector<int> reverseFour(std::vector<int>)':
E> VF_cppfunction.cpp:72:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
E>   for(int revPos = 0; revPos < Four.size(); revPos++)
E>                              ^
E> e:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o VirFinder.dll tmp.def RcppExports.o VF_cppfunction.o -LE:/r/bin/x64 -lR
E> RcppExports.o:RcppExports.cpp:(.rdata+0x720): undefined reference to `VirFinder_countSeqFeatureCpp'
E> collect2.exe: error: ld returned 1 exit status
E> no DLL was created
E> ERROR: compilation failed for package 'VirFinder'
E> * removing 'C:/Users/86181/AppData/Local/Temp/RtmpMRdJ6J/devtools_install_74465715ac2/VirFinder'

函数 countSeqFeatureCpp 位于 VF_cppfunction.cpp , src 文件夹中 这是我从github下载的生物信息学R包,并且该包可以成功安装。我的主管告诉我修改它的一些功能。当我想使用devtools::load()或重建这个包时,我遇到了这些错误,可悲的是。


// Enable C++11
// [[Rcpp::plugins("cpp11")]]
// [[Rcpp::export]]
List countSeqFeatureCpp( CharacterVector RseqDNA,  int k) {
    
    // convert to C++ type
    //Rcout << "seq is " ;
//  char seqDNAChar[RseqDNA.size()];
//  for( int i=0; i < RseqDNA.size(); i++ ){
//      //Rcout << RseqDNA[i];
//      seqDNAChar[i] = Rcpp::as< char >(RseqDNA[i]);
//  }
    
    unsigned long power = 1; for( int i = 0; i < k-1; i++) power *= 4;
    HashTable.clear();

    // count kmer
    unsigned long total = SeqKmerCountSingle(RseqDNA, k, power);
    
    // pair words and output count
    //vector<unsigned long> kmerTen;
    vector<double> kmerCount;
    loadToVector(k, total, kmerCount);
    //Rcout << "\n total:" << total << endl;

    // convert to Rcpp type
    //NumericVector RkmerTen(kmerTen.size());
    //RkmerTen = kmerTen;
    //NumericVector RkmerCount(kmerCount.size());
    //RkmerCount = kmerCount;
    
    List ret;
    //ret["kmerTen"] = kmerTen;
    ret["kmerCount"] = kmerCount;
    return ret;
    
}

我不确定是什么原因。有人可以给我一些建议吗?非常感谢!

r bioinformatics r-package
1个回答
0
投票

删除countSeqFeatureCpp.R文件后即可编译成功。

© www.soinside.com 2019 - 2024. All rights reserved.