尝试编译时R抛出错误 [英] R throwing errors when trying to compile

查看:72
本文介绍了尝试编译时R抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用R生成2个文件,第一个实际上生成了不错的文件,但是第二个告诉我以下内容:

I am trying to use R to generate 2 files the first one actually generates pretty good but the 2nd one tells me the following:

conteo_correlaciones.c:3:15:错误:R.h:没有这样的文件或目录conteo_correlaciones.c:4:24:错误:Rinternals.h:没有此类文件或目录conteo_correlaciones.c:31:错误:预期为"=",,",;",关联"之前的"asm"或"属性"

Rh和Rinternals.h都是从R目录复制的,它们与其余文件位于同一目录中,但我无法克服此错误,这些文件被包含这样的文件调用:

both R.h and Rinternals.h were copied from the R directory and they're in the same directory that the rest of the files but I can't get past this error, these files are being called by an include like this:

#include <R.h>
#include <Rinternals.h>

而我在终端中正在做的是:

and what I'm doing in the terminal is:

R CMD SHLIB conteo_correlaciones.c

哪些软件效果很好,并为我生成了正确的文件,并且:

Which works great and generates me the correct file and:

gcc -dynamiclib conteo_correlaciones.c -o conteo_correlaciones.so

哪个抛出了我上面提到的错误.知道会是什么吗?

Which throws me the aforementioned error. Any idea what could be?

推荐答案

您必须进行更改

#include <R.h>
#include <Rinternals.h>

#include "R.h"
#include "Rinternals.h"

如果头文件与代码文件位于同一目录中.或者,您可以在gcc命令行中添加正确的包含路径(例如 -I/usr/share/R/include ).

if the header files are in the same directory like your code files. Or you could add the correct include-path to gcc commandline (e.g. -I/usr/share/R/include).

这篇关于尝试编译时R抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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