NTNU-IHB/FMI4cpp

Solve compile errors cause by typed_scalar_variable.hpp

Closed this issue · 2 comments

When compiling with Visual Studio 2019 errors occur in typed_scalar_variable.hpp since the min and max member functions of bounded_scalar_variable.
This can be solved by undefining the old min and max macros via:

#ifdef max
#undef max
#endif

#ifdef min
#undef min
#endif

Care to make a PR? I assume that when this is applied directly to the header, we don't need this definition here anymore:

add_definitions("-DNOMINMAX" "-D_CRT_SECURE_NO_WARNINGS")

In another project I was involved with, a similar issue was resolved by applying in the cpp file:

#if defined(_WIN32) && !defined(NOMINMAX)
#    define NOMINMAX
#endif

However, I'm not sure adding this to the header is a good idea. What if the client project relies on these macros?
Would it be better to just apply it in your own project?

Closing due to lack of feedback from issue reporter