conflicting declaration error when compiling in Rcpp, but g++ works fine

北城以北 提交于 2019-12-11 14:49:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!