Skip to content
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

warning C4003: not enough arguments for function-like macro invocation 'max' #479

Closed
willdieh opened this issue Jan 16, 2020 · 1 comment

Comments

@willdieh
Copy link

willdieh commented Jan 16, 2020

After upgrading to 2.0.200115.8 I'm getting the following warning/error when compiling .\Generated Files\winrt\base.h (lines 2635, 3228):

warning C4003: not enough arguments for function-like macro invocation 'max'
error C2589: '(': illegal token on right side of '::'
error C2062: type 'unknown-type' unexpected
error C2059: syntax error: ')'

This seems to be due to (long existent) conflict between std::numeric_limits::max() and the max(a, b) macro defined in minwindef.h included as part of Windows.h.

It might be helpful to wrap the call to std::numeric_limits::max() in parenthesis to allow it to co-exist with the MS macro like so:

(std::numeric_limits::max)()

as documented here: https://stackoverflow.com/questions/1394132/macro-and-member-function-conflict

Thanks for cppwinrt!

@kennykerr
Copy link
Collaborator

Thanks for reporting this. I already have a fix in PR, but you can define NOMINMAX for the time being to work around this.

jeffdiclemente added a commit to CppMicroServices/CppMicroServices that referenced this issue Jun 30, 2021
Workaround a conflict on Windows with the min macro defined in minwindef.h, usually included by Windows.h.
See microsoft/cppwinrt#479 for details
jeffdiclemente added a commit to CppMicroServices/CppMicroServices that referenced this issue Jun 30, 2021
* Add missing include


Signed-off-by: The MathWorks, Inc. <[email protected]>

* Update CounterLatch.h

Workaround a conflict on Windows with the min macro defined in minwindef.h, usually included by Windows.h.
See microsoft/cppwinrt#479 for details
nick20201 pushed a commit to nick20201/argparse that referenced this issue Mar 17, 2023
jungikim added a commit to jungikim/mecab-ko_cmake that referenced this issue Feb 3, 2024
jungikim added a commit to jungikim/mecab_cmake that referenced this issue Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants