sourcecpp cannot find 'RcppArmadillo.h', but cxxfunction can

Viewed 2886

I have run into this weird problem: when I try to use my sourcecpp() on my cpp file, it will generate this error: fatal error: 'RcppArmadillo.h' file not found.

My cpp file is something like this

#include "RcppArmadillo.h"
// [[ Rcpp :: depends ( RcppArmadillo )]]
using namespace arma;
using namespace Rcpp;
...

But I am pretty sure that I have my RcppArmadillo.h and the weird thing is, if I compile the function using cxxfunction(..., plugin="RcppArmadillo"), everything will work just fine.

Even more weird is that after I ran cxxfunction() function, sourcecpp() will suddenly work on all my cpp files using RcppArmadillo.h.

What is going on?

1 Answers
Related