<div dir="ltr"><div>I have a package that compiles C++ at runtime using sourceCpp and I would like to use testthat with the package. Its clear that testthat sets up a non-standard environment and so it is difficult to combine it with sourceCpp. The first hurdle was include paths not working.</div><div><br></div><div>This bit of code in the test_ file seemed to fix that:</div><div><br></div><div><div>ccflags = Sys.getenv("CCFLAGS")</div><div>ipath = file.path(getwd(), "inst", "include")</div><div>ccflags = if (nzchar(ccflags)) paste(ccflags, paste0("-I", ipath)) else paste0("-I", ipath)</div><div>Sys.setenv(CCFLAGS = ccflags)</div></div><div><br></div><div>However, once compiled, the object does not load correctly as I cannot call the compiled function. Does anyone have a workaround? (I have searched and not found anything terribly useful.)</div><div><br></div><div>THK</div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><a href="http://www.keittlab.org/" target="_blank">http://www.keittlab.org/</a></div></div></div>
</div>