Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Scheibe__Patrick
New Contributor I
71 Views

min macro with Microsoft OS

Hi,

I have a small program written for Linux and OSX which I need to compile for Windows. The problem is simple. I have a class defining a member-function "min". When I try to compile it under windows, I get

warning #945: type qualifier ignored inline const Label2D& min(const Label2D &other) and

error: inline specifier allowed on function declarations only inline const Label2D& min(const Label2D &other)

and some more which all point to the fact that "min" is already defined as macro. The question is: When does this happen and is there a way to turn it off?

I'm not using any "using namespace std;" directives inside the code and this error never occured on OSX or Linux. Compiler switches in Windows are:

"/c /O2 /Ob2 /Ehsc /MD /GS /fp:fast /W1 /TP /Zm1000 /Qparallel /Qtbb /Qopenmp" and some includes and defines like "WIN32". any ideas?

Cheers Patrick

0 Kudos
2 Replies
Scheibe__Patrick
New Contributor I
71 Views

Hi again,

I found it. It seems that defining NOMINMAX solves the problem. I didn't use any windows header and was confused where this came from..

Cheers

Patrick

TimP
Black Belt
71 Views

It's really annoying when people define min functions which conflict with std::min(). Among other problems, it leads quickly to the situation where the namespace has to be explicit on each usage. Current Ct has its own min(), so we have already the Microsoft default conflict and one introduced by Intel.
Reply