Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dependsAttribute

Rcpp::depends Attribute


Description

The Rcpp::depends attribute is added to a C++ source file to indicate that it has a compilation dependency on one or more other packages. For example:

// [[Rcpp::depends(RcppArmadillo)]]

Arguments

...

Packages which the source file depends on for compilation

Details

The Rcpp::depends attribute is used by the implementation of the sourceCpp function to correctly setup the build environment for R CMD SHLIB.

The include directories of the specified packages are added to the CLINK_CPPFLAGS environment variable. In addition, if the referenced package provides an inline plugin it is called to determine additional environment variables required to successfully build.

Note

The Rcpp::depends attribute is specified using a syntax compatible with the new generalized attributes feature of the C++11 standard. Note however that since this feature is not yet broadly supported by compilers it needs to be specified within a comment (see examples below).

See Also

Examples

## Not run: 

// [[Rcpp::depends(RcppArmadillo)]]

// [[Rcpp::depends(Matrix, RcppGSL)]]

## End(Not run)

Rcpp

Seamless R and C++ Integration

v1.0.6
GPL (>= 2)
Authors
Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Nathan Russell, Douglas Bates and John Chambers
Initial release
2021-01-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.