minwindef.h
min
and max
macros conflicting with std::numeric_limits
#957
Labels
minwindef.h
min
and max
macros conflicting with std::numeric_limits
#957
Description
I'm using
libcpr
together with another library (glaze
). In files where both are used (libcpr for requests and Glaze for JSON parsing of the response text), compilation is failing with the following error:If the two libraries are included in the following way, the above error appears:
By defining the NOMINMAX symbol before including the libcpr headers, the error disappears:
Inverting the include order also works:
Example/How to Reproduce
On Windows, include the libcpr headers before any code that uses
std::numeric_limits::max()
orstd::numeric_limits::min()
.Possible Fix
Define the
NOMINMAX
preprocessor symbol before including Windows headers inlibcpr
. As far as I've seen themin
andmax
macros fromminwindef.h
are unused by libcpr.Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
The text was updated successfully, but these errors were encountered: