我在编译 C 代码方面相对缺乏经验。不过,我正在尝试使用 emscripten 将 R 源代码中的算法编译成 JavaScript。该函数位于名为 pf.c
的文件中 here
天真地,我刚刚进入 src
目录并尝试:
emcc nmath/pf.c
这导致:
In file included from nmath/pf.c:25:
nmath/nmath.h:38:10: fatal error: 'Rconfig.h' file not found
#include <Rconfig.h>
^
1 error generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
我知道这个标题在哪里:
$ find . -name "Rconfig.h"
./gnuwin32/fixed/h/Rconfig.h
我的直接问题是,我如何告诉编译器这个 header 存在于何处?
我想以 JavaScript 中的 pf
函数结束。任何对此想法的见解都将不胜感激。
最佳答案
使用 -I
添加到包含搜索路径。
emcc nmath/pf.c -Ignuwin32/fixed/h/
关于整体想法...听起来很奇怪,我不知道。
关于javascript - 为 C 编译器指定 header 位置(使用 emscripten 编译 R 代码),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28522171/