Skip to content

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

@willdieh

Description

@willdieh

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions