<RInside.h> 的致命错误 [英] Fatal error for <RInside.h>

查看:37
本文介绍了<RInside.h> 的致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过终端运行这个例子.但是得到了 fatal error: RInside.h: No such file or directory 该行的错误,#include.它是从 C++ 到 R 的接口.我在 R 中有 RInside 包.我的代码:

I am running this example, through terminal. But got fatal error: RInside.h: No such file or directory error for the the line, #include<RInside.h>. Its a interface to R from c++. I have RInside package in R. my code:

#include<iostream>
#include<RInside.h>
using namespace std;
int main(){
    int a=12;
    cout<<a<<endl;
    return 0;  
}

#include 标头发生同样的错误.

Same error occurred for #include<Rcpp.h> header.

#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
NumericVector callFunction(NumericVector x, Function f) {
    NumericVector res = f(x);
    return res;
}

RInside 版本 0.2.14

Package RInside version 0.2.14

包 Rcpp 版本 0.12.17

Package Rcpp version 0.12.17

推荐答案

examples 文件夹中与 RInside 一起提供的 GNUmakefile 包括诸如:

The GNUmakefile shipped with RInside in the examples folder includes things like:

## comment this out if you need a different version of R, 
## and set set R_HOME accordingly as an environment variable
R_HOME :=       $(shell R RHOME)

[...]
## include headers and libraries for R 
RCPPFLAGS :=        $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=         $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=        $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=      $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## if you need to set an rpath to R itself, also uncomment
#RRPATH :=      -Wl,-rpath,$(R_HOME)/lib

## include headers and libraries for Rcpp interface classes
## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
RCPPINCL :=         $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS :=         $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)


## include headers and libraries for RInside embedding classes
RINSIDEINCL :=      $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS :=      $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
CXX :=          $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS :=         -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=         $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
LDLIBS :=       $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)

如果您使用 GNU make,您可能可以按字面意思使用它.否则,您将不得不使其适应您的构建环境.请查看提供的示例以了解更多详细信息.

If you use GNU make, you can probably use this literally. Otherwise you will have to adapt it for your build environment. Please look at the provided examples for more details.

这篇关于&lt;RInside.h&gt; 的致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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