1

Here's what I have been doing for almost 6 days and haven't got any solution.

I am trying to call some C functions from R on my Win7 system. The R code includes function which contains other statistics function(like multivariate normal density function etc.). Now to make a copy of that same function in C, I need to use GSL GNU libraries(or anything else could also be useful?). So I downloaded the setup, source and binary files from the GNU website.

I saved all the stuff i.e. R, RStudio, Rtools, GNU software, and CodeBlocks(using this for writing the C function, contains its own gcc compiler) at the same location in the disc. I changed the path accordingly.

I am now trying to call R CMD SHLIB filename.c and even the SHLIB -lgsl -lgslcblas -lm -o commands but none seems to be working.

How can I succesfully finish the compilation process and move ahead with my R code?

Anthon
  • 69,918
  • 32
  • 186
  • 246
Ankit Jain
  • 53
  • 6
  • Why not use the [gsl package](http://cran.r-project.org/web/packages/gsl/index.html)? – Joshua Ulrich Jun 13 '15 at 05:21
  • But that would be helpful in creating the R code I guess. Right? I have already made the R code. So I need to make functions in the C code which does the same work as the R code. P.S. I'm always getting an error like `fatal error: gsl/gsl_file.h: no such file or directory found. Compilation terminated` – Ankit Jain Jun 13 '15 at 08:08
  • You could try using [RcppGSL](http://dirk.eddelbuettel.com/code/rcpp.gsl.html) since a vast majority of C code can be compiled with a C++ compiler. It seems like this would be simpler than messing around with `R CMD SHLIB` IMO... – nrussell Jun 13 '15 at 18:15
  • Okay. Thanks a lot for your suggestions. I'll try RcppGSL. – Ankit Jain Jun 14 '15 at 07:40
  • Have you tried to add the option `-Ipath\to\directory\with\gsl_file.h` ? – Horst Grünbusch Jul 23 '15 at 22:35
  • Yes, didn't work though! – Ankit Jain Jul 27 '15 at 07:22

0 Answers0