Building R packages (C API) with Visual Studio
问题 I'm trying to build a simple R package with Visual Studio, here is my code: #include <R.h> #include <Rinternals.h> SEXP add(SEXP a, SEXP b) { SEXP result = PROTECT(allocVector(REALSXP, 1)); REAL(result)[0] = asReal(a) + asReal(b); UNPROTECT(1); return result; } I have R runtime and RTools installed. When I try to compile it, I get the following link error: error LNK2019: unresolved external symbol REAL referenced in function "struct SEXPREC * __cdecl add(struct SEXPREC *,struct SEXPREC *)" (