tips & tricks/Qt

MSVC warning C4003: not enough actual parameters for macro 'max'

manywaypark 2018. 1. 31. 13:54

problem:

Windows, MSVC 환경에서 min이나 max가 포함된 qt 파일(eg, qrandom.h 등)에서 다음과 같은 경고가 나온 후에, 괴상한 에러가 나면서 컴파일에 실패하는 경우가 발생했다.

warning C4003: not enough actual parameters for macro 'max'


solution:

windows.h가 include 되기 전에 다음과 같은 선언을 넣어준다.

#ifndef NOMINMAX

# define NOMINMAX

#endif


ref: https://stackoverflow.com/questions/6884093/warning-c4003-not-enough-actual-parameters-for-macro-max-visual-studio-2010


happy hackin'