Re: [eigen] Vs 2017: compilation of Cwise_erf.cpp. Cwise_erfc.cpp and Cwise_lgamma.cpp failed.

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Thanks for pointing out this issue. Actually, this was already fixed in the default branch. I backported the fix.

cheers,
gael



On Wed, Mar 20, 2019 at 3:45 PM Oleg Shirokobrod <oleg.shirokobrod@xxxxxxxxx> wrote:
Hi,

Compilation of Cwise_erf.cpp. Cwise_erfc.cpp and Cwise_lgamma.cpp examples failed with VS 2017 compiler. It failed because macro EIGEN_HAS_C99_MATH in Macros.h defined to 0. This macro is used only for cwise calculation of special functions in unsupported module. It is defined to 0 because msvc does not define __STDC_VERSION__ macro although vs 2017 implements C++11 standard and implements erf, erfc and lgamma functions which are only necessary for Eigen special functions module. I suggest to modify macro EIGEN_HAS_C99_MATH definition in Macros.h file.
Instead of

// Does the compiler support C99?
#ifndef EIGEN_HAS_C99_MATH
#if EIGEN_MAX_CPP_VER>=11 && \
    ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))       \
  || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
  || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)))

  #define EIGEN_HAS_C99_MATH 1
#else
  #define EIGEN_HAS_C99_MATH 0
#endif
#endif

define

// Does the compiler support C99?
#ifndef EIGEN_HAS_C99_MATH
#if EIGEN_MAX_CPP_VER>=11 && \
    ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))       \
  || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
  || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \
  || (defined(_MSC_VER) && _MSVC_LANG >= 201402))

  #define EIGEN_HAS_C99_MATH 1
#else
  #define EIGEN_HAS_C99_MATH 0
#endif
#endif

With this modification VS 2017 compiles examples and gives write results.

Best regards,

Oleg Shirokobrod.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/