내 C++ 프로그램을 컴파일 할 때 R 파일을 연결하고 있지만 Rcpp에는 libRcpp.so 파일이 없습니다.libRcpp.so 파일이 없으면 어떻게 Rcpp를 연결할 수 있습니까?
#include <R.h>
#include <Rcpp.h>
#include <RInside.h>
**** some c++ code*****
RInside R(argc, argv);
string cmd = "tmpf <- tempfile('nums');"
"png(tmpf);"
"counts <- table(a,b,c,d,e);"
"barplot(counts, main='My Plot', xlab='Letters');"
"dev.off();"
"tmpf";
string tmpfile = R.parseEval(cmd);
cout << "Using plot " << tmpfile << endl;
unlink(tmpfile.c_str());
가 그럼 난 g 컴파일 ++와 같은 :
이g++ -I/home/robert/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include
-I/home/robert/R/x86_64-pc-linux-gnu-library/3.2/RInside/include
-I/usr/share/R/include -L/usr/lib/R/lib -lR
-L/home/robert/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/libs -lRcpp
-L/home/robert/R/x86_64-pc-linux-gnu-library/3.2/RInside/lib -lRInside
Frequency-Analyzer.cpp
오류가 읽
/usr/bin/ld: cannot find -lRcpp
collect2: error: ld returned 1 exit status
다음
(나는 ++은 C를 남겨 두었다)를 R 코드
-L/home/robert/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/libs
은로 이어지지 않기 때문입니다."libRcpp.so"
파일 하지만 더 이상 링크를 지원하지 않으므로 내 디렉토리에 lib 파일이 없습니다. RInside를 사용하여 컴파일하려면 어떻게해야합니까 ??
examples/디렉토리에 RInside에 포함 된 (GNU) Makefile을 사용하십시오. –
감사합니다. 이것은 효과가 있었다. 덕분에 프로그램을 조금 더 잘 구축하는 방법을 이해할 수있었습니다. – Robe
다행입니다. 아래 답변을 수락 해주십시오. –