[R] C function calling in R

Cetinyürek Aysun Aysun.Cetinyurek at ulg.ac.be
Fri Feb 20 13:07:11 CET 2009

Dear all,
I have a problem in calling my C code from R. If I do not need to use
#include<R.h>, the codes work properly. But when I need to use it, my
codes produce an error as:

logpostCLM.cpp:7:15: error: R.h: No such file or directory
logpostCLM.cpp:8:24: error: Rinternals.h: No such file or directory
logpostCLM.cpp:9:19: error: Rmath.h: No such file or directory
logpostCLM.cpp:10:24: error: R_ext/BLAS.h: No such file or directory

My computer is an HP using Window Vista.
My code in codeblocks starts as below:

typedef double *vector;

extern "C"{

#include <R.h>
#include <Rinternals.h>
#include <Rmath.h>
#include <R_ext/BLAS.h>

void logpostCLM(int *n, int *nk,int *nZ,int *len_sbin,double *phi,double
*tau,double *lksi, double *coeff, double *thetaml, double *L,double
*P,double *lB, double *CL,double *CR, double *Z,double *lpost)
{ /* n=sample size */

Thank you very much.



More information about the R-help mailing list