<div dir="ltr">Hi Tal,<div><br></div><div>If you run sourceCpp(..., verbose=TRUE), you'll see that the source code is copied into a temporary directory, and then the working directory is reset to that directory. So the header file is no longer discovered there. (not to mention, you would have to tell sourceCpp where to find those function definitions that have been included as well... building a package does that behind the scenes for you)</div>
<div><br></div><div>I think you should stay with recompiling the package, rather than switching to sourceCpp, when debugging a package.</div><div><br></div><div>-Kevin</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Aug 19, 2013 at 11:37 AM, Tal Galili <span dir="ltr"><<a href="mailto:tal.galili@gmail.com" target="_blank">tal.galili@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello dear list members,<div><br></div><div>I'm working the an a package with Rcpp code, and would like to have a cpp function in one file, and then be able to access it from another.</div><div>It appears that using:</div>


<div>#include "file_name.hpp"<br></div><div>Works great while compiling.</div><div><br></div><div>However, when debugging the file, I discovered the when I use "sourceCpp" on the file which has "#include", it is not able to find the other functions and I get:</div>


<div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>fatal error: src/is_functions.hpp: No such file or directory compilation terminated. make: *** [get_branches_heights.o] Error 1 </div>


</div><div><div>Error in Rcpp::sourceCpp("src/get_branches_heights.cpp") : </div></div><div><div>  Error 1 occurred building shared library.</div></div></blockquote><div><br></div><div>I've tried using:</div>


<div>#include "src/file_name.hpp"<br></div><div>instead, but it didn't help either.</div><div><br></div><div>Is there something I'm missing?</div><div><br></div><div><br></div><div>Thanks.</div><div><br>


</div><div><br></div><div><br></div><div><br clear="all"><div><div dir="ltr"><br>----------------Contact Details:-------------------------------------------------------<br>Contact me: <a href="mailto:Tal.Galili@gmail.com" target="_blank">Tal.Galili@gmail.com</a> |  <br>


Read me: <a href="http://www.talgalili.com" target="_blank">www.talgalili.com</a> (Hebrew) | <a href="http://www.biostatistics.co.il" target="_blank">www.biostatistics.co.il</a> (Hebrew) | <a href="http://www.r-statistics.com" target="_blank">www.r-statistics.com</a> (English)<br>


----------------------------------------------------------------------------------------------<br><br></div></div>
</div></div>
<br>_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br></blockquote></div><br></div>