#define NOMINMAX needs to be called before including windows.h in order to avoid the macro defined version of min and max. These implementations will cause errors with using std::min or std::max. This causes non portable code for windows specifically.