Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define NOMINMAX #642

Open
malytomas opened this issue Mar 14, 2021 · 0 comments
Open

define NOMINMAX #642

malytomas opened this issue Mar 14, 2021 · 0 comments

Comments

@malytomas
Copy link
Contributor

The header cubeb_ringbuffer.h is including cubeb_utils.h, which includes cubeb_utils_win.h which includes windows.h.

Windows.h, unfortunately, defines macros min and max, which collides with std::min and std::max.

This breaks not just user code, but also the ringbuffer itself.

Luckily, defining these macros can be suppressed by defining NOMINMAX before including the windows.h.

As a bonus to consider, more macros can be defined to strip even more functionality from windows.h, which can speed up compilation:

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant