-2
我在構建基本示例rcpp_hello_world時遇到問題。 我已按照 http://blog.fellstat.com/?p=170rcpp_hello_world。未定義的參考
提到的例子是一切ok達聯,當我發現以下錯誤
Building target: MyCppPackage_4
Invoking: Cross G++ Linker
g++ -L/usr/local/R/lib64/R/lib -o "MyCppPackage_4" ./src/RcppExports.o ./src/main.o ./src/rcpp_hello_world.o /usr/local/R/lib64/R/library/Rcpp/libs/Rcpp.so /usr/local/R/lib64/R/library/RInside/lib/libRInside.so -lR -lRblas
./src/main.o: In function `main':
/home/luigi/workspace-mars/MyCppPackage_4/Debug/../src/main.cpp:22: undefined reference to `rcpp_hello_world'
collect2: error: ld returned 1 exit status
make: *** [MyCppPackage_4] Error 1
這裏的main.cpp文件的代碼
/*
* main.cpp
*
* Created on: Jun 13, 2016
* Author: luigi
*/
#ifdef INSIDE
#include <Rcpp.h>
#include <RInside.h> // for the embedded R via RInside
#include "rcpp_hello_world.h"
using namespace Rcpp;
using namespace std;
//RcppExport SEXP rcpp_hello_world();
#include <unistd.h>
int main(int argc, char *argv[]) {
RInside R(argc, argv); // create an embedded R instance
SEXP s = rcpp_hello_world();
Language call("print",s);
call.eval();
return 0;
}
#endif
對不起帖子 我很感謝任何提示
我很感謝您的及時性,我遵循您的提示 – luigi