问题
I am trying to compile an Rcpp package that relies on the external library HDFql.
First, I tried compiling a plain .cpp file following the directions in the reference manual, which worked fine:
g++ example.cpp -I./include/HDFql ./HDFql/libHDFql.a -fopenmp -ldl
where the ./include/HDFql
folder contains the header files and ./HDFql/libHDFql.a
is the static library.
Then I tried doing the equivalent in an Rcpp package. My package directory structure is
|- R
|- script. r
|- src
|- HDFql
|- libHDFql.a
|- example.cpp
|- Makevars
|-inst
|- include
|- HDFql
|- ... header files...
Where the contents of Makevars
is
PKG_CPPFLAGS = -I../inst/include/HDFql/
PKG_LIBS = ./HDFql/libHDFql.a
LDLIBS = -fopenmp -ldl
I also added #include <Rcpp.h>
to example.cpp
. Running devtools::document()
yields
../inst/include/HDFql/H5public.h:156:19: error: conflicting declaration ‘typedef long long int ssize_t’ typedef long long ssize_t;
Which I don't understand at all. Can anyone explain what is happening here?
EDIT link to Github repository
来源:https://stackoverflow.com/questions/49806979/conflicting-declaration-error-when-compiling-in-rcpp-but-g-works-fine