kthohr / optim

OptimLib: a lightweight C++ library of numerical optimization methods for nonlinear functions

Home Page:https://optimlib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error on MSVC - optim_options.hpp

suhasghorp opened this issue · comments

Hello,

Trying to compile the examples in VS 2022, C++17. Geting error C1017 - Invalid integer constant expression in optim_options.hpp at line 78.
The error is somewhere in this block. Based on MS documentation about this error at C1017
it says : Constants defined using #define must have values that evaluate to an integer constant if they are used in an #if, #elif, or #else directive.
Any idea how to fix this?

Thank you.

// floating point number type

#ifndef OPTIM_FPN_TYPE
#define OPTIM_FPN_TYPE double
#endif

#if OPTIM_FPN_TYPE == float //this is line 78
#undef OPTIM_FPN_SMALL_NUMBER
#define OPTIM_FPN_SMALL_NUMBER fp_t(1e-05)
#elif OPTIM_FPN_TYPE == double
#undef OPTIM_FPN_SMALL_NUMBER
#define OPTIM_FPN_SMALL_NUMBER fp_t(1e-08)
#else
#error floating-point number type must be 'float' or 'double'
#endif

Windows-based builds are not supported.