std::numeric_limits<qint64>::min() is considered a broken macro. How so?



  • Hello.

    I'am on Ubuntu 14.04.5 LTS 64bit
    with g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4,
    compiling against Qt5.2.1

    I've run into this compilation error, and can't figure why this is happening:

    /usr/include/qt5/QtCore/qdatetime.h:122:77: error: macro "min" requires 2 arguments, but only 1 given
         static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
    

    Why is this?
    How do I fix this?

    Full file compilation messages:

    g++ -c -m64 -pipe -std=c++11 -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_DESIGNER_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I../coord_editor -I/usr/include/geod -I/usr/include/qt5 -I/usr/include/qt5/QtDesigner -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtXml -I/usr/include/qt5/QtDBus -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I. -I. -o main.o ../coord_editor/main.cpp
    In file included from /usr/include/qt5/QtCore/qlibraryinfo.h:46:0,
                     from /usr/include/qt5/QtCore/QtCore:18,
                     from /usr/include/qt5/QtDBus/QtDBusDepends:2,
                     from /usr/include/qt5/QtDBus/QtDBus:3,
                     from ../coord_editor/xml/coord_editor_adp.h:16,
                     from ../coord_editor/widget.h:14,
                     from ../coord_editor/main.cpp:1:
    /usr/include/qt5/QtCore/qdatetime.h:122:77: error: macro "min" requires 2 arguments, but only 1 given
         static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
                                                                                 ^
    /usr/include/qt5/QtCore/qdatetime.h: In static member function 'static qint64 QDate::nullJd()':
    /usr/include/qt5/QtCore/qdatetime.h:122:73: error: invalid conversion from 'long long int (*)()noexcept (true)' to 'qint64 {aka long long int}' [-fpermissive]
         static inline qint64 nullJd() { return std::numeric_limits<qint64>::min(); }
    

  • Qt Champions 2016

    Hi
    I think you have redefined min/max (as macro) and
    it seems your version there since it says macro "min"

    Try to use
    std::numeric_limits<qint64>::min()
    in your main program and see if it accepts it there.



  • @mrjj Thanx, indeed the way to go.

    Third party library comes with a header, containing a min() macro and breaking the build.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.