I want to embed R into a C++ program. So I installed R, Rcpp and RInside also. But I get a lot of "undefined reference to" errors while compiling with g++ in UNIX. The command I give for compiling is
g++ -I/path/to/R/include -I/path/to/Rcpp/include -I/path/to/RInside/include -L/path/to/R/libs -L/path/to/Rcpp/libs -L/path/to/RInside/libs test.cpp -lRlapack -lRcpp -lRblas -lRInside"
test.cpp:
#include <RInside.h>
int main(int argc, char *argv[]) {
RInside R(argc, argv); // create an embedded R instance
R["txt"] = "Hello, world!\n"; // assign a char* (string) to 'txt'
R.parseEvalQ("cat(txt)"); // eval the init string, ignoring any returns
exit(0);
}
Errors:
Undefined reference to R_ClassSymbol
Undefined reference to R_NilValue
I get similar 110 undefined errors to R variables.I have installed R and other packages to my own location rather than default location. I am stuck with this error for 2 days now.I seem to doing everything right like linking etc. Thanks in Advance.