[Rcpp-devel] Cannot find header file R.h in Rcpp c++ package

Mingyu Tang alectang8888 at gmail.com
Thu Apr 12 23:06:49 CEST 2012


Hi Dirk,

Thanks for your reply.
I am new hand on this and got a little confused.
So instead of using 'g++' , I should use 'R CMD SHLIB' to compile my c++ code, right?

Could you complete the command in the command line? For example, let's say, my c++ file is 'example.cpp'. Shall I input  'R CMD SHLIB example.cpp' ? which flag shall I use to indicate where the Rcpp package is?

Thank you very much.

Mingyu

On Apr 12, 2012, at 11:50 AM, Dirk Eddelbuettel wrote:

> 
> Hi,
> 
> Thanks for posting here.
> 
> On 12 April 2012 at 11:40, Mingyu Tang wrote:
> | Hi,
> | 
> | I am trying to use the Rcpp and RInside package in C++ on my Macbook. 
> | When I compile the examples given on the website, the compiler returns that
> | "R.h: No such file or directory". And also a lot of other header files cannot
> | be found. And I searched in the package manually, and I did not find this R.h
> | file as well. Can anyone tell me what's going wrong here?
> | 
> | I downloaded Rcpp_0.9.10.tar package from CRAN. 
> | I used the following command to compile:
> | g++ -I /Users/alectang8888/Downloads/Rcpp/include example.cpp -o example
> 
> Rcpp is an R extension package.  R packages have a very specific way of being
> built which is explained in detail in the 'Writing R Extensions' manual that
> comes with R.  In short, you want 'R CMD SHLIB ...' or 'R CMD COMPILE ...'
> most of the time.
> 
> If you do want to do it by hand using g++, you have to add -I flags for R as
> well as Rcpp does not exist outside of R. 
> 
> See the Rcpp-FAQ vignette for more details.
> 
> Dirk
> 
> | 
> | Thank you in advance.
> | 
> | regards,
> | 
> | --
> | ----------------------------------
> | Mingyu Tang
> | PhD candidate,
> | Department of Statistics,
> | Carnegie Mellon University
> | Pittsburgh, PA 15213
> | 
> | 
> | ----------------------------------------------------------------------
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel at lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> -- 
> R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
> See agenda, registration details and more at http://www.RinFinance.com



More information about the Rcpp-devel mailing list