[Rcpp-devel] Cannot run rcpp due to missing include file(s)

Paul Fishwick metaphorz at gmail.com
Sun May 3 17:59:19 CEST 2020

System: Mac OSX 11 (Catalina), Rstudio with R version 3.6.3 (but have also
tried 4.0 and 3.3),
Xcode version 11.4.1

Went to:  http://adv-r.had.co.nz/Rcpp.html#rcpp-intro

and tried library(rcpp) which worked fine because I previously had
installed the rcpp package.

The following yields an error in finding config.h. I did a "find" on
config.h and sure enough it is not
in the clang++ -I directory references. Here is what I have tried:

Installing Xcode's command line tools (which were installed using
xcode-select --install)
Also, downloaded and installed the version of clang8 and gfortran6.1 from:


The following error occurs when I try this rcpp example from Hadley but it
also happens whenever
I try to install an R package from source. The compile fails due to not
finding some include file.

I would have thought that installing clang8 would have also included the
proper include (.h) file directories
with their contents needed by R.

Is there something I am missing below? Thank you.

> library(Rcpp)
> cppFunction('int add(int x, int y, int z) {
+   int sum = x + y + z;
+   return sum;
+ }')
In file included from fileb6e52d3a23c3.cpp:1:
In file included from
In file included from
In file included from
In file included from
In file included from
In file included from /usr/local/include/math.h:8:
In file included from /usr/local/include/features.h:10:
/usr/local/include/forwards.h:10:10: fatal error: 'config.h' file not found
#include "config.h"
1 error generated.
make: *** [fileb6e52d3a23c3.o] Error 1
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
-I/usr/local/include  -fPIC  -Wall -g -O2  -c fileb6e52d3a23c3.cpp -o
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir =
cacheDir,  :
  Error 1 occurred building shared library.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200503/0f6f8f61/attachment.html>

More information about the Rcpp-devel mailing list