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

Dirk Eddelbuettel edd at debian.org
Thu Apr 12 17:50:59 CEST 2012


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