[Rcpp-devel] [R] Help with integrating R and c/c++

Dirk Eddelbuettel edd at debian.org
Sat Feb 19 22:44:08 CET 2011


On 19 February 2011 at 11:37, Dirk Eddelbuettel wrote:
| On 19 February 2011 at 22:51, Rohit Pandey wrote:
| You need a compiler.  Start by reading Appendix D of the 'R Administration'
| manual available with your R installation as well as on all mirrors.
| I am adding something to the Rcpp-FAQ vignette to that effect now.

Below is what I added to the Rcpp-FAQ. The pdf will come out with the next
revision of Rcpp. 

Hope this helps,  Dirk

1.2 What do I need ?

Obviously, R must be installed. Rcpp provides a C++ API as an extension to
the R system. As such, it is bound by the choices made by R and is also
influenced by how R is configured.  In general, the standard environment for
building a CRAN package from source (even when it contains C or C++ code) is
required. This means one needs:

 * a development environment with a suitable compiler (see below), header
   files and required libraries; 
 * R should be built in a way that permits linking and possibly embedding of
   R; this is typically ensured by the -enable-shared-lib option;
 * standard development tools such as make etc.

1.3 What compiler can I use?

On almost all platforms, the GNU Compiler Collection (or gcc, which is also
the name of its C language compiler) has to be used along with the
corresponding g++ compiler for the C++ language. A minimal suitable version
is a final 4.2.* release; earlier 4.2.* were lacking some C++
features. Generally speaking, and as of early 2011, the default compilers on
all the common platforms are suitable.

Specific per-platform notes:
  Windows users need the Rtools package from the site maintained by Duncan 
    Murdoch which contains all the required tools in a single package; 
    complete instructions specific to Windows are in the ‘R Administration’ 
    manual (R Development Core Team, 2010a, Appendix D). 
  OS X users, as noted in the ‘R Administration’ manual (R Development Core 
    Team, 2010a, Appendix C.4), need to install the Apple Developer Tools
    (e.g., Xcode) (as well as gfortran if R or Fortran-using packages 
    are to be built).
  Linux user need to install the standard developement packages. Some
    distributions provide helper packages which pull in all the required
    packages; the r-base-dev package on Debian and Ubuntu is an example.  

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the Rcpp-devel mailing list