<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I've run into the same issue and have been using the Rcpp's plugin framework to work around it.</div><div><br></div><div>My R file defines a local_include plugin as follows:</div><div><br></div><div><div>registerPlugin("local_include", </div><div>                function() {</div><div>                    list(env = list(PKG_CXXFLAGS=paste0("-I",path.expand("~/Desktop/project/include"))))</div><div>                }</div><div>              )</div></div><div><br></div><div>and the cpp file uses that plugin with:</div><div><br></div><div>// [[Rcpp::plugins(local_include)]]</div><div><br></div><div>This also works well if you need to link to some additional library or anything else compiler flag related.</div><div><br></div>-Colin<div><br><div><div>On Aug 19, 2013, at 8:33 PM, Tal Galili <<a href="mailto:tal.galili@gmail.com">tal.galili@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Thank you Kevin and Dirk,<div>I was hoping for for an easier fix (such as, having sourceCpp give a parameter controlling where it was building the thing).</div><div>Thank you both for the explanations.</div>

<div><br></div><div>Best,</div><div>Tal</div><div><br></div><div><br></div></div><div class="gmail_extra"><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>
<br><br><div class="gmail_quote">On Tue, Aug 20, 2013 at 2:54 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
On 19 August 2013 at 11:51, Kevin Ushey wrote:<br>
| If you run sourceCpp(..., verbose=TRUE), you'll see that the source code is<br>
| copied into a temporary directory, and then the working directory is reset to<br>
| that directory. So the header file is no longer discovered there. (not to<br>
<br>
</div>Correct.  [ A colleague was just bitten / frustrated by that today. ]<br>
<div class="im"><br>
| mention, you would have to tell sourceCpp where to find those function<br>
| definitions that have been included as well... building a package does that<br>
| behind the scenes for you)<br>
|<br>
| I think you should stay with recompiling the package, rather than switching to<br>
| sourceCpp, when debugging a package.<br>
<br>
</div>You can also use a standard -I/some/path/... switch --- but for the reason<br>
Kevin explained so nicely (ie R building in a temp. dir) you cannot just say<br>
"use my local dir" via -I. but have to be explicit: -I/home/tal/some/dirk or,<br>
if you must -IC:/some/win/doze/path.<br>
<br>
Longer-term, a package is your friend. And hey, you already have one :)<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com/" target="_blank">http://dirk.eddelbuettel.com</a><br>
</font></span></blockquote></div><br></div>
_______________________________________________<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>https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</blockquote></div><br></div></body></html>