C++ function not available
<p>I have the following file cumsum_bounded.cpp</p>

<pre><code>#include &lt;Rcpp.h&gt;
using namespace Rcpp;

//' Cumulative sum.
//' @param x numeric vector
//' @param low lower bound
//' @param high upper bound
//' @param res bounded numeric vector
//' @export
//' @return bounded numeric vector
// [[Rcpp::export]]
NumericVector cumsum_bounded(NumericVector x, double low, double high) {
    NumericVector res(x.size());
    double acc = 0;
    for (int i=0; i &lt; x.size(); ++i) {
        acc += x[i];
        if (acc &lt; low)  acc = low;
        else if (acc &gt; high)  acc = high;
        res[i] = acc;
    }
    return res;
}
</code></pre>

<p>I then Build &amp; Reload and test out my new function.</p>

<pre><code>cumsum_bounded(c(1, -2, 3), low = 2, high = 10)
[1] 1 0 3
</code></pre>

<p>Then I build the documentation.
<code>devtools::document()</code></p>

<p>When I <code>Build &amp; Reload</code> everything compiles fine.</p>

<p>But when I run <code>cumsum_bounded(c(1, 2, 3), low= 2, high = 10)</code> I get the error:</p>

<pre><code>Error in .Call("joshr_cumsum_bounded", PACKAGE = "joshr", x, low, high) : 
  "joshr_cumsum_bounded" not available for .Call() for package "joshr"
</code></pre>

<p>NAMESPACE</p>

<pre><code># Generated by roxygen2: do not edit by hand

export(cumsum_bounded)
</code></pre>

<p>Update:</p>

<p>If I create a new project as above and DON'T use the <code>Build &amp; Reload</code> function but rather devtools::loadall(), it will work. But once I press that <code>Build &amp; Reload</code> button, it goes sideways.</p>