如何安装/定位R.h和Rmath.h头文件? [英] How to install/locate R.h and Rmath.h header files?
问题描述
我正在尝试在终端中编译一些C代码(称为rand_beta),其中包含使用gcc -o rand_beta rand_beta.c
包含R.h和Rmath.h头文件的行,因此我可以从R内调用该代码.
但是,我收到错误消息:
I am trying to compile some C code (called rand_beta) in terminal which contains the lines to include R.h and Rmath.h header files using gcc -o rand_beta rand_beta.c
so I can then call the code from within R.
However, I get the error messages:
rand_beta.c:1:15: error: R.h: No such file or directory
rand_beta.c:2:19: error: Rmath.h: No such file or directory
似乎应该随R一起安装的这些头文件不在我的系统上.
It seems that these header files which should come installed with R are not on my system.
有人可以指导我如何让我的计算机查找R头文件吗?我需要从某个地方下载它们吗?
Can someone guide me as to how I can get my computer to find the R header files? Do I need to download them from somewhere?
推荐答案
其他答案试图猜测您的R安装目录在哪里.但是,还有一个更强大的解决方案.使用 R
中的R.home
命令在任何位置均可找到它:
The other answers try to guess where your R installation directory is. But there is a more robust solution. Use the R.home
command in R
to find it wherever it is:
> R.home('include')
/usr/lib64/R/include
这是我系统上包含R.h
和Rmath.h
的文件夹.您的文件夹可能位于其他位置.
That is the folder containing R.h
and Rmath.h
on my system. Your folder may be in a different place.
这篇关于如何安装/定位R.h和Rmath.h头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!