使用RStudio在R包中编译Rcpp代码时出错 [英] Error when compiling Rcpp code in an R package using RStudio

查看:55
本文介绍了使用RStudio在R包中编译Rcpp代码时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Rstudio创建一个程序包,并探索使用Rcpp程序包来访问C ++代码,但是,当尝试构建该程序包时,会引发如下错误:

I am using Rstudio to create a package, and exploring the use of the Rcpp package to gain access to C++ code, however, when trying to build the package, and error is being thrown as follows:

严重错误:Rcpp.h:没有这样的文件或目录

仅当考虑 src 文件夹中的独立C ++文件时,内联C ++代码编译良好,显然是指 #include< Rcpp.h> 指令 .cpp 文件的头.

Inline C++ code compiles fine, its only when considering standalone C++ files in the src folder, obviously referring to the #include <Rcpp.h> directive at the head of the .cpp file.

我认为这可能与环境变量有关,有人知道正确的配置是什么,以及如何修复在Ubuntu 12.04 LTS环境中运行的Rstudio吗?

I think it may have something to do with environment variables, does anyone know what the correct configuration is and how to fix for Rstudio operating in an Ubuntu 12.04 LTS environment?

sourceCpp('./src/xyz.cpp')命令按预期执行,当从内部执行 Build and Reload 时抛出错误RStudio IDE.

The commands sourceCpp('./src/xyz.cpp') execute as to be expected, the error is being thrown when Build and Reload is executed from within the RStudio IDE.

推荐答案

如果没有可用的软件包,很难说.我想你想念:

It is hard to say without having the package available. I guess you miss:

LinkingTo: Rcpp

在您的DESCRIPTION文件中.

in your DESCRIPTION file.

这篇关于使用RStudio在R包中编译Rcpp代码时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆