How to install/locate R.h and Rmath.h header files?

前端 未结 3 1725
慢半拍i
慢半拍i 2021-01-11 14:55

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

3条回答
  •  灰色年华
    2021-01-11 15:23

    Another way is to specify some environment variables to directly use the include path:

    export CPATH=/usr/lib64/R/include/
    export C_INCLUDE_PATH=/usr/lib64/R/include/
    export CPLUS_INCLUDE_PATH=/usr/lib64/R/include/
    export GCC_INCLUDE_DIR=/usr/lib64/R/include/
    

    This should then run fine:

    gcc -o rand_beta rand_beta.c
    

提交回复
热议问题