[R-pkg-devel] compiling C sources on windows

Kevin Ushey kev|nu@hey @end|ng |rom gm@||@com
Mon Apr 19 18:06:22 CEST 2021

I suspect the cause is this:


Usually, you only need to explicitly use __declspec if you're
compiling with MSVC -- it shouldn't be necessary when using a MinGW
toolchain (as R's toolchain is). You could try adding something like:

#ifdef __MINGW32__

If you need to test locally on Windows, there are free virtual
machines available here:


On Mon, Apr 19, 2021 at 2:14 AM Brad Eck <bradleyjeck using gmail.com> wrote:
> Dear List -
> I'm working to get a package of mine that was archived last year back on to
> The epanet2toolkit provides an R interface to the EPANET simulation engine
> that is written in C.
> The latest development version of the package builds and checks ok on mac
> and linux but fails to
> compile and install on windows with a bunch of errors like:
> undefined reference to `_imp__*`
> where * is some function defined in a header file and implemented in the
> corresponding source file.
> Am i missing a compiler flag or something?
> Current output from winbuilder :
> https://win-builder.r-project.org/9aIcl8Fxu7w1/00install.out
> or https://pastebin.com/8JQNpNKp
> source code: https://github.com/bradleyjeck/epanet2toolkit/tree/v22dev
> Any insights appreciated.
> Brad
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list