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

#include <soloud.h> ostensily breaks STL with #define min() #330

Open
Cons-Cat opened this issue Sep 21, 2021 · 2 comments
Open

#include <soloud.h> ostensily breaks STL with #define min() #330

Cons-Cat opened this issue Sep 21, 2021 · 2 comments

Comments

@Cons-Cat
Copy link

My team had a problem today. We #include <soloud.h>, which in turn includes <windows.h>. This causes std::min() to not compile elsewhere in the codebase, because windows.h defines a custom min() macro. This can be fixed by #define NOMINMAX right before the include of windows.h.

Currently we fix this by defining NOMINMAX before including soloud, but this was a source of much stress for us until we figured this out. I think it might be good for Soloud to make this define automatically on line 42 of soloud.h, right before including windows.h, to prevent this from being a problem in the first place. We tested that the define placed there does indeed fix the issue.

@Green-Sky
Copy link

IMHO windows.h should not be included by soloud.h.
Just had a look at it and a forward declare of OutputDebugStringA() should be enough to replace the #include.

@jarikomppa
Copy link
Owner

Should, yes. I tried a few permutations with no success. As a workaround you can always define SOLOUD_NO_ASSERTS which also removes the include.

I do wonder, though, if printing to stderr leads somewhere sane in windows nowadays..

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

Successfully merging a pull request may close this issue.

3 participants