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

Not enough arguments for function-like macro invocation 'min' #796

Open
peakpeak-github opened this issue Aug 31, 2023 · 2 comments
Open

Comments

@peakpeak-github
Copy link

peakpeak-github commented Aug 31, 2023

Windows 10, Visual Studio 2022 set to C++17, error when including date.h
date.h(419,27): warning C4003: not enough arguments for function-like macro invocation 'min':
static CONSTCD11 year min() NOEXCEPT { return year{-32767}; }

Visual Studio claims min() is defined in minwindef.h:
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

The .cpp file starts like this:
#include <windows.h>
#include "date\date.h"

How can I resolve this?

@HowardHinnant
Copy link
Owner

#define NOMINMAX just prior to including Windows headers to inhibit this behavior. There's a place in the MS IDE somewhere for such macros.

@peakpeak-github
Copy link
Author

Thanks! That worked!

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