Preventing Visual Studio from defining min and max

To prevent Visual Studio from defining it’s own min and max functions, include the following in the top of your implementation file:

#ifdef _WIN32
    #ifndef NOMINMAX
        #define NOMINMAX
    #endif
#endif

You can also define NOMINMAX in the Preprocessor Definitions option in the Common Properties->C/C++->Proprocessor property page.

Leave a Reply

Your email address will not be published. Required fields are marked *