[Rcpp-devel] Rcpp::depends not picking up inst/include/

JJ Allaire jj.allaire at gmail.com
Fri Nov 30 21:04:42 CET 2012

> That section, if I'm reading correctly states that if the package (the
> one from Rcpp::depends)  exports a plugin then it will add it to the
> linkingtoPackages and if it doesn't then it won't and these are what
> are processed by .buildClinkCppFlags.

Line 371 adds the package to the list of linkingToPackages without any
qualifications. Later we check for a plugin but absence of a plugin
does not prevent the package's inst/include directory from added to
the compilation.

The behavior you are seeking is the intended behavior, so there must
be something else going on here. I put together a simple package to
try to reproduce the problem:


After compiling and building the following code works fine for me:

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

#include <TestPackageDepends.h>

#include <TestPackageDependsForwarder.h>

// [[Rcpp::export]]
void callFunction() {

A possible problem: does myForwarder.h include only the definitions of
forwarders or does it also include the definitions of exported
functions. If it only has forwarders and you are trying to call
exported functions then that would yield a compilation error (although
it would have nothing to do with inst/include).

More information about the Rcpp-devel mailing list