Skip to content
Prev 2202 / 10988 Next

[Rcpp-devel] How to link a .lib file in a rcpp-package in a Windows environment?

Hi Dirk,

thank you for your answer.

I tried to write a very simple, pure package (without Rcpp), with the C-File named "ROnlyTest", where I put the code like suggested by you.

The Makevars.win contains now only: (*)
PKG_CPPFLAGS=-I.
PKG_LIBS=Plastic.lib

Unfortunetely, I can not compile (fail at "Rcmd check ROnlyTest") --- and I get the following error-message:
	ROnlyTest.cpp:3:1: error: 'SEXP' does not name a type

When I then write a "void" before the "SEXP", I get the error:
expected initializer before 'simpleText'
I am sure it is quite trivial, but I just do not know what to write as an "initializer".... , or to do this line just right.

But, apart from that, when the only thing I write into the C-File is:
	#include "PlasticHeader.h"
	int x = CallAFunctionFromPlasticDotLib();
then Rcmd check runs through nice, and I can build and install this package. Does that mean that the linking of Plastic.lib from above (*) was succesful?

In the latter case, now what would be the line I would have to add to Makevars.win, or how do I have to modify the PKG_LIBS Line in order to incorporate "Plastic.lib"?


Thanks a lot,
Bernhard