Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. std::numeric_limits<qint64>::min() is considered a broken macro. How so?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Garrikus
    wrote on last edited by
    #1

    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(); }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      2
      • G Offline
        G Offline
        Garrikus
        wrote on last edited by
        #3

        @mrjj Thanx, indeed the way to go.

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

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved