Reputation: 21
I am writing an R package and I am trying to include some of the functionality of the Shogun toolbox for machine learning. I first included the shogun folder which contains the C++ functions in the /inst/include/
folder. I then added the following statements to my Makevars
and Makevars.win
files:
PKG_CPPFLAGS = -I../inst/include/
I then tried a test so in a file called test.cpp
which I placed in /src
, and which includes the following:
#include <shogun/lib/config.h>
and I get the error: test.cpp: fatal error: shogun/lib/config.h: No such file or directory
compilation terminated.
What am I doing wrong?
Upvotes: 0
Views: 90
Reputation: 20746
You are trying to create a header only package out of a library that is not header only.
That is to say in the /inst/include/
you have a mixture of .h
and .cpp
. To rectify this, you should only retain the .h
files in /inst/include/
. Keep a copy of the .h
and .cpp
together files in /src
.
The best package to model your package after is RcppMLPACK1
with its use of inst/include/
, src/
, plugin manager definition, and linking plus cxx flags.
However, you might just want to create a package that links to system's libraries. e.g. RcppMLPACK2
. This package uses configure.ac
, which is the master autoconf
to generate configure
to ensure the necessary paths are present. Note of extensions to autoconf
in the m4
directory
Upvotes: 2