[Interest] compilation error in qdatetime

Graham Labdon Graham.Labdon at avalonsciences.com
Fri Nov 8 18:03:32 CET 2013


I have defined a macro named min in my code!

-----Original Message-----
From: interest-bounces+graham.labdon=avalonsciences.com at qt-project.org [mailto:interest-bounces+graham.labdon=avalonsciences.com at qt-project.org] On Behalf Of Thiago Macieira
Sent: 08 November 2013 16:40
To: interest at qt-project.org
Subject: Re: [Interest] compilation error in qdatetime

On sexta-feira, 8 de novembro de 2013 16:36:14, Graham Labdon wrote:
> Hi
> I amusing Qt5 with Visual Studio and one of my projects is giving the 
> following error
> 
> c:\qt\qt5.1.1\5.1.1\msvc2012\include\qtcore\qdatetime.h(121): error C2589:
> '(' : illegal token on right side of '::'
> 1>c:\qt\qt5.1.1\5.1.1\msvc2012\include\qtcore\qdatetime.h(121): error
> C2059: syntax error : '::' 1>  moc_EventSimulator.cpp
> 
> I can get a successful compilation by adding 'NOMINMAX' to the list of 
> pre processor macros
> 
> I would be grateful if someone could explain why this error occurs

The error occurs because that line is:
  static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }

If you have a macro called "min", it will wreak havoc with the source code. 
Please stop defining macros called min. We're in 2013.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



More information about the Interest mailing list