R Language Specifying Additional Build Dependencies


Example

To use additional packages within the Rcpp ecosystem, the correct header file may not be Rcpp.h but Rcpp<PACKAGE>.h (as e.g. for RcppArmadillo). It typically needs to be imported and then the dependency is stated within

// [[Rcpp::depends(Rcpp<PACKAGE>)]]

Examples:

// Use the RcppArmadillo package
// Requires different header file from Rcpp.h
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]

// Use the RcppEigen package
// Requires different header file from Rcpp.h
#include <RcppEigen.h>
// [[Rcpp::depends(RcppEigen)]]