Open nickbeth opened 10 months ago
@lynxnb the solution was really helpful since it is not worth it to change every file in the cpr and append the line#define NOMINMAX
before the #include <windows.h>
, so maybe it's better if we can just define other macro on our own in our project.
Your solution really helped me. Thanks
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