biojppm / rapidyaml

Rapid YAML - a library to parse and emit YAML, and do it fast.
MIT License
583 stars 100 forks source link

Namespace conflict with windows.h #416

Closed fpf3 closed 7 months ago

fpf3 commented 7 months ago

Using single header configuration, Visual Studio 2019.

On line 10658 of ryml.hpp:

  static volatile float fmin = std::numeric_limits<float>::min();

This generates the error:

Severity    Code    Description Project File    Line    Suppression State
Error   C2589   '(': illegal token on right side of '::'    ocean_optics    C:\Users\Public\HgRepos\telestar_plus_integration\yaml_dependencies\include\ryml.hpp    10658   

This is probably because the windows SDK defines min to be:

#define min ((a > b) ? b : a))

This preprocessor definition clobbers min regardless of namespacing.

I've already tried defining NOMINMAX in the build properties, which is supposed to fix this issue. It doesn't seem to have an effect.

fpf3 commented 7 months ago

NOMINMAX was not applied to every projects' build settings. Doing so fixed this. Closing.