aldro61 / mmit

Regression trees for interval censored output data
https://aldro61.github.io/mmit/
GNU General Public License v3.0
7 stars 7 forks source link

INFINITY instead of isinf #38

Closed tdhock closed 5 years ago

tdhock commented 5 years ago

Hi @parismita @aldro61 I tried to compile mmit on windows/g++ and I got the following error message,

$ R CMD INSTALL Rpackage
* installing to library 'C:/Users/th798/R/win-library/3.6'
* installing *source* package 'mmit' ...
** using staged installation
** libs
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG          -O2 -Wall  -mtune=generic -c interface.cpp -o interface.o
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG          -O2 -Wall  -mtune=generic -c piecewise_function.cpp -o piecewise_function.o
c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mtune=generic -c registerDynamicSymbol.c -o registerDynamicSymbol.o
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG          -O2 -Wall  -mtune=generic -c solver.cpp -o solver.o
solver.cpp: In function 'int compute_optimal_cost(int, double*, double*, double*, double, int, int*, double*, double*)':
solver.cpp:102:36: error: 'isinf' was not declared in this scope
             if (!isinf(lower_vec[i]))
                                    ^
solver.cpp:102:36: note: suggested alternative:
In file included from solver.cpp:15:0:
c:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/cmath:614:5: note:   'std::isinf'
     isinf(_Tp __x)
     ^
solver.cpp:115:36: error: 'isinf' was not declared in this scope
             if (!isinf(lower_vec[i]))
                                    ^
solver.cpp:115:36: note: suggested alternative:
In file included from solver.cpp:15:0:
c:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/cmath:614:5: note:   'std::isinf'
     isinf(_Tp __x)
     ^
solver.cpp:123:36: error: 'isinf' was not declared in this scope
             if (!isinf(upper_vec[i]))
                                    ^
solver.cpp:123:36: note: suggested alternative:
In file included from solver.cpp:15:0:
c:/Rtools/mingw_64/x86_64-w64-mingw32/include/c++/cmath:614:5: note:   'std::isinf'
     isinf(_Tp __x)
     ^
make: *** [solver.o] Error 1
ERROR: compilation failed for package 'mmit'
* removing 'C:/Users/th798/R/win-library/3.6/mmit'

which I fix in this PR by using INFINITY and -INFINITY instead of isinf. please review before I merge with master.

aldro61 commented 5 years ago

Looks good! Thanks for the fix Toby!