[R-pkg-devel] Compiling error with the new R.h header (R-devel 3.3.0 for Windows) when using the C++ function isnan() of <math.h>
Antonio Canale
antonio.canale at unito.it
Wed Apr 20 14:28:20 CEST 2016
Dear all,
my problem is related to the new version of my msBP package but it
actually applies also to the current version uploaded on CRAN
(https://cran.r-project.org/web/checks/check_results_msBP.html).
It turns out that the package cannot be compiled under the new R-devel
for windows.
The problem is related to the isnan() function of <math.h> library of
C++ which I call twice in one of my C++ scripts.
Consider the function below as MWE
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<R.h>
#include<Rmath.h>
extern "C"{
void gibbs(double *A)
{
if(isnan(A[i]) || (A[i]<=0))
{ do stuff }
}
}
Precisely, the error that I get is reported at
https://www.r-project.org/nosvn/R.check/r-devel-windows-ix86+x86_64/msBP-00install.html
I've have found in the R-devel blog and check myself that from R
version 3.3.0 the header file R.h is changed. In particular it is now
going to include the C++ versions of system header ‘<cmath>’ rather
than the legacy header ‘<math.h> which seems to be the source of my
problem.
However I cannot understand why it causes the error and in particular
why it is happening *only under windows* and not under other OS. I've
check my new package both in OS X and Ubuntu (with R-devel) and
everything is OK. It also compiles fine in Windows under R.3.2.5.
Thanks for your help.
Best,
Antonio
--
Antonio Canale
University of Turin and
Collegio Carlo Alberto
sites.carloalberto.org/canale
More information about the R-package-devel
mailing list