Nominate our 2022 Qt Champions!

C2589: '(' : illegal token on right side of '::'

  • Hello,

    I have encountered the same problem found here, and tried all of the recommended solutions:

    qdatetime.h gives a syntax error at the line:
    static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }

    The error is:
    C:\Qt\Qt5.2.1\5.2.1\msvc2012_64_opengl\include\QtCore\qdatetime.h:122: error: C2589: '(' : illegal token on right side of '::'

    I have windows.h declared in a header file (which is probably a bad idea), but have included before it:
    #define NOMINMAX #include <limits>

    Also in the .pro file I have included DEFINES += NOMINMAX

    For some reason this error still persists. Any ideas?


  • Did you define NOMINMAX before windows.h ?

    #define NOMINMAX
    #include <windows.h>

  • take a look on "this":

    try to undef min and max before using min and max from the <limits>

Log in to reply