luca-scr / GA

An R package for optimization using genetic algorithms
http://luca-scr.github.io/GA/
91 stars 29 forks source link

Fix compile errors on Windows (and Linux?) #11

Closed yutannihilation closed 6 years ago

yutannihilation commented 6 years ago

Hi, I heard some people can't install this via install_github() currently. When I tried by myself, I got two types of errors:

  1. error: ‘round’ is not a member of ‘std’
  2. error: 'isnan' was not declared in this scope

IIUC, 1. indicates you are trying to use C++11, where round is the member of std and 2. is just a lack of std::, right? This PR is an attempt to fix the problem.

luca-scr commented 6 years ago

Thanks for reporting the issues. I have included your std::isnan suggestion but not using round function from C++11 since I would like to avoid the further dependency on on C++11. Note also that for vector Rcpp sugar has a round function. Thus for double I wrote my own round function called round_double. Checked the package on windows with rhub package and compile with no errors.

yutannihilation commented 6 years ago

I see. Thanks for the quick fix! I confirmed now I can install_github() on my Windows 👍