C function calling in R
On 2/20/2009 7:07 AM, Cetiny?rek Aysun wrote:
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:
This is really an R-devel question. Please follow up there. You don't say how you tried to compile it. You need to make sure your compiler knows where to find the header files (and your linker knows where to find the libraries). R CMD SHLIB or R CMD INSTALL will do that; were you using one of those? Duncan Murdoch
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.
Regards,
A.C.Y
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.