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.gal...@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.gal...@gmail.com |
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
> ----------------------------------------------------------------------------------------------
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel@lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to