sctplab/usrsctp

min/max defines collide with C++ on MSVC

nazar-pc opened this issue · 3 comments

These defines:

#if !defined(_MSC_VER) && !defined(__MINGW32__)
#define min(a,b) (((a)>(b))?(b):(a))
#define max(a,b) (((a)>(b))?(a):(b))
#endif

Cause problems with MSVC compiler when included in C++ project that uses std::min/max, because min and max are replaced with define contents.

Here is an example pipeline with such errors: https://github.com/nazar-pc/mediasoup/runs/3152529859?check_suite_focus=true

Would be nice to not define such a generic things in C, the issue is essentially similar to #600

Why don't you compile the library with a c compiler and link your project against it? This stuff is internal to the library...

I guess it is included anyway due to being in a header file or maybe MSVC it insane that way, not sure yet.

Hm, even though it is defined in usrsctp, I suspect it might not be the reason I'm getting that error, must be just because other dependency doesn't define NOMINMAX for MSVC in meson.build, sorry for the false report.