【问题标题】:Compiling C code with R header files使用 R 头文件编译 C 代码
【发布时间】:2011-09-12 18:55:53
【问题描述】:

我需要 R 头文件来编译一些东西。我通过以下方式在 ubuntu 上安装了 R:

sudo apt-get r-base-dev

R 工作正常。但我找不到 R 标头,例如 Rmath.h。尝试编译时出现此错误:

gcc -g -std=c99 -I/usr/include -O3 -lRmath -lm -lpthread -o qcpg qcpg.c
In file included from qcpg.c:1:0:
qcpg.h:19:19: fatal error: Rmath.h: No such file or directory
compilation terminated.
make: *** [qcpg] Error 1

有什么想法吗??

【问题讨论】:

  • 头文件可能不在/usr/include 中(或在子目录中)。您可能需要检查/usr/local/include。找到头文件后,将包含语句更新为 /r/header/dir/usr/include/r/dir

标签: c r header compilation


【解决方案1】:

你也想做

sudo apt-get install r-mathlib

其中包含文件/usr/include/Rmath.h

【讨论】:

  • 哎呀,比我快几秒钟。 +1
  • 对不起,下次你会赢的:)
  • R.h 头文件呢?
猜你喜欢
  • 2017-07-28
  • 2023-03-22
  • 1970-01-01
  • 2019-07-31
  • 1970-01-01
  • 2022-06-13
  • 1970-01-01
  • 1970-01-01
  • 2015-06-20
相关资源
最近更新 更多