I'm hoping someone can assist. I'm new to C, and I've been experimenting with some code from the R project. The project I've created consists of a main.c file and several header files. I've attached my project. The main.c file looks as follows:
Code:
#include "Rinternals.h"
int main(int argc, char** argv) {
}
SEXP Cdqrls(SEXP x, SEXP y, SEXP tol, SEXP chk)
{
SEXP ans;
SEXP qr, coefficients, residuals, effects, pivot, qraux;
int n, ny = 0, p, rank, nprotect = 4, pivoted = 0;
double rtol = asReal(tol), *work;
}
The Rinternals.h file is this file from the R Project source: https://svn.r-project.org/R/trunk/sr...e/Rinternals.h
I've included this header file in the same folder as the main.c file, and I've also included in this folder all the header files that are in the Rinternals.h #includes statements. When I attempt to compile this, I get the following error:
Code:
main.c:34: undefined reference to `Rf_asReal'
The error relates to this line specifically:
Code:
double rtol = asReal(tol), *work;
I've tried a number of things, and can't seem to find a way to get this code to compile. I'm currently working in Netbeans and compiling with GNU GCC Compiler (get the same error when using Code::blocks). Any help with this would be greatly appreciated.