-
Notifications
You must be signed in to change notification settings - Fork 256
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
Windows.h defines min() as a macro, which conflicts with argparse #105
Comments
#109 should fix it |
I'm having the same issue, even though I'm running the most recent version ( Context:
|
I'm seeing the same here with current head revision.
|
This program fails to compile with MSVC 19.16.27045 and Windows SDK 10.0.19041.0:
The error messages are super cryptic:
After some digging, it turns out that
Windows.h
definesmin
as a macro:which conflicts with
argparse
's use ofstd::min
inargparse.hpp:120
, sincemin(...)
will get expanded by the macro:std::next(val.begin(), std::min(size, repr_max_container_size) - 1),
This StackOverflow answer mentions wrapping
std::min
in parentheses to prevent macro-expanding:std::next(val.begin(), (std::min)(size, repr_max_container_size) - 1),
but if you're not willing to make an exception for this, I think the README should mention another solution, which involves defining NOMINMAX before including Windows.h to tell it not to define
min()
:The text was updated successfully, but these errors were encountered: