[Rcpp-devel] sourceCpp and #include .hpp ?

Kevin Ushey kevinushey at gmail.com
Mon Aug 19 20:51:13 CEST 2013


Hi Tal,

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)

I think you should stay with recompiling the package, rather than switching
to sourceCpp, when debugging a package.

-Kevin


On Mon, Aug 19, 2013 at 11:37 AM, Tal Galili <tal.galili at gmail.com> wrote:

> Hello dear list members,
>
> 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.
> It appears that using:
> #include "file_name.hpp"
> Works great while compiling.
>
> 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:
>
> fatal error: src/is_functions.hpp: No such file or directory compilation
> terminated. make: *** [get_branches_heights.o] Error 1
> Error in Rcpp::sourceCpp("src/get_branches_heights.cpp") :
>   Error 1 occurred building shared library.
>
>
> I've tried using:
> #include "src/file_name.hpp"
> instead, but it didn't help either.
>
> Is there something I'm missing?
>
>
> Thanks.
>
>
>
>
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> ----------------------------------------------------------------------------------------------
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130819/77e23e80/attachment.html>


More information about the Rcpp-devel mailing list