I want to call an R function from C++ code using Visual Studio. The code is below. I am getting the following error:
"error LNK2019: unresolved external symbol _Rf_initEmbeddedR referenced in function _main"
I could not find definition of "_Rf_initEmbeddedR"
. Can anyone help on how to integrate R with C++ code?
enter code here
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include "Rinternals.h"
#include "Rembedded.h"
SEXP hello() {
return mkString("Hello, world!\n");
}
int main(int argc, char **argv)
{
SEXP x;
Rf_initEmbeddedR(argc, argv);
x = hello();
return 0;
}