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.