Reputation: 25778
I am getting the following errors when I build a sample code using QT5, Visual Studio 2012 x64,
static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
1>c:\qt\qt5.1.1\5.1.1\msvc2012_64_opengl\include\qtcore\qdatetime.h(121): warning C4003: not enough actual parameters for macro 'min'
1>c:\qt\qt5.1.1\5.1.1\msvc2012_64_opengl\include\qtcore\qdatetime.h(121): error C2589: '(' : illegal token on right side of '::'
1>c:\qt\qt5.1.1\5.1.1\msvc2012_64_opengl\include\qtcore\qdatetime.h(121): error C2059: syntax error : '::'
How to fix?
Upvotes: 2
Views: 1623
Reputation: 9465
Instead of using
<Windows.h>
you can also use
<qwindows.h>
which takes care of this stuff or use NOMINMAX
Upvotes: 2
Reputation: 5322
This should fix it for you: https://forum.qt.io/topic/21605/solved-qt5-vs2010-qdatetime-not-enough-actual-parameters-for-macro-min-max/5
The C++ min/max macro are being wrong called. So you can set the NOMINMAX before call the header to solve.
There're several ways to achieve that, as it's being described in the link I sent.
i.e:
#define NOMINMAX
#include <windows.h>
or set the compiler parameter /DNOMINMAX
or pass to qmake project: DEFINES += NOMINMAX
Upvotes: 4