On 20 April 2016 at 14:28, Antonio Canale wrote: | 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
Newer compilers get you more stringent enforcement of standards, so it is now std::isnan. That would be the same with g++-4.9 on other OSs. You could avoid the whole issue and just use the macros included via the R headers. Or you could use a certain package ending in 'pp' which helps with C++ and R integration as it too gives you a few helpers ... | 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. That is good C++ practice. | 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. Not an R version issue but a compiler issue. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel