การเชื่อมโยง R.h Rembedded.h ด้วยรหัส C

ฉันกำลังรวมไฟล์ส่วนหัวบางส่วน:

#include <gsl/gsl_machine.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_cblas.h>
#include <gsl/gsl_sf_gamma.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_linalg.h>

#include <R.h>
#include <Rmath.h>
#include <Rembedded.h>
#include <Rdefines.h>
#include <R_ext/Lapack.h>
#include <R_ext/Linpack.h>

ฉันสามารถเชื่อมโยงไลบรารี blas และ gsl ได้โดยใช้คำสั่งต่อไปนี้ ( -lm ใช้สำหรับคณิตศาสตร์หรือไม่):

gcc -arch x86_64 myfile.c -o myfile -lgsl -lm -lgslcblas

แต่ฉันได้รับข้อผิดพลาด:

myfile.c:21:15: error: R.h: No such file or directory
myfile.c:22:19: error: Rmath.h: No such file or directory
myfile.c:23:23: error: Rembedded.h: No such file or directory
myfile.c:24:22: error: Rdefines.h: No such file or directory
myfile.c:25:26: error: R_ext/Lapack.h: No such file or directory
myfile.c:26:27: error: R_ext/Linpack.h: No such file or directory

ฉันจะเชื่อมโยงไฟล์ส่วนหัวเมื่อรวบรวมรหัส C ของฉันได้อย่างไร


person user1971988    schedule 04.10.2013    source แหล่งที่มา


คำตอบ (1)


ไฟล์ส่วนหัวไม่ได้ลิงก์ แต่รวมอยู่ด้วยเท่านั้น ข้อผิดพลาดหมายถึงสิ่งที่พวกเขาพูด: คอมไพเลอร์หาไม่พบ ตรวจสอบให้แน่ใจว่าอยู่ในไดเร็กทอรีรวมมาตรฐาน บางทีคุณอาจไม่ใช่ make install ไลบรารี R หากไฟล์ส่วนหัวอยู่ในไดเร็กทอรีเดียวกันกับไฟล์ต้นฉบับอื่นๆ ของคุณที่มีเครื่องหมายคำพูดคู่แทนวงเล็บมุม:

#include "R.h"

คุณสามารถเพิ่มไดเร็กทอรีอื่น ๆ ลงในรายการไดเร็กทอรีรวมมาตรฐานด้วย -I flag ถึง GCC

person Kninnug    schedule 04.10.2013