我有一个使用Rcpp的包。它具有不同的C++函数定义的int src/testr.h。现在,我需要生成Rcpp函数(使用cppFunction或cxxfunction),这些函数使用src/testr.h中定义的内容。我怎么能这么做?
我试过了
> cxxfunction(signature(x="list") includes = c('#include "testr.h"'), body=sprintf(template, name, name))
> Rcpp::cppFunction(depends = "testr", includes = c('#include "src/testr.h"'), sprintf(template, name, name))但
file7086270f0da.cpp:7:10: fatal error: 'testr.h' file not found
#include "testr.h"
^ 发布于 2015-03-05 18:11:04
快速建议:
inst/include/testr.h;src/Makevars条目(如PKG_CPPFLAGS = -I../inst/include )来查看编译。mypkg,您可以添加一个depends="mypkg",R将知道为您设置一个-I...。我们在BH和各种Rcpp*包中一直使用相同的技巧。
https://stackoverflow.com/questions/28883314
复制相似问题