soloud
soloud copied to clipboard
#include <soloud.h> ostensily breaks STL with #define min()
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.
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
.
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..