Skip to content

MSVC confuse std::max with windows max macros #13

@howard-scu

Description

@howard-scu

when i compiled cmdline in vs2016, i got the following error

1>cmdline.h(586) : error C2589: '(' : illegal token on right side of '::'
1>cmdline.h(586) : error C2143: syntax error : missing ';' before '::'

the solution is to use

max_width = (std::max)(max_width, (ordered[i]->name().length()));

to instead the line

max_width = std::max(max_width, (ordered[i]->name().length()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions