Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. QDeadLineTimer - error C2039: max is no member of std::numeric_limits
QtWS25 Last Chance

QDeadLineTimer - error C2039: max is no member of std::numeric_limits

Scheduled Pinned Locked Moved Solved Language Bindings
vs2015cppqdeadlinetimer
8 Posts 2 Posters 4.3k Views
  • 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.
  • B Offline
    B Offline
    betaros
    wrote on 2 May 2017, 10:37 last edited by betaros 5 Feb 2017, 10:38
    #1

    Hi,

    I try to compile my code, but I get the following errors in Visual Studio 2015:

    1>  ### Compiling Common Headers...
    1>c:\qt\5.8\msvc2015\include\qtcore\qdeadlinetimer.h(61): error C2039: "max": Is no member of "std::numeric_limits<__int64>"
    1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(960): note: view declaration of "std::numeric_limits<__int64>"
    1>c:\qt\5.8\msvc2015\include\qtcore\qdeadlinetimer.h(61): error C3861: "max": Identifier not found.
    1>c:\qt\5.8\msvc2015\include\qtcore\qdeadlinetimer.h(69): error C2039: "max": Is no member of "std::numeric_limits<__int64>"
    1>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\limits(960): note: view declaration of "std::numeric_limits<__int64>"
    1>c:\qt\5.8\msvc2015\include\qtcore\qdeadlinetimer.h(69): error C2065: "max": Identifier not declared
    

    As you may see in the path, I use Qt 5.8 and translated the error messages to english. Do you have any idea, how I can compile my code?

    Greetings
    betaros

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 May 2017, 21:35 last edited by
      #2

      Hi and welcome to devnet,

      Can you share your .pro file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        betaros
        wrote on 3 May 2017, 07:22 last edited by
        #3

        Hi,

        I didn't had a .pro file, but I generated one with Visual Studio. I cannot show you the whole file, but I hope my edited version might also help. I just removed the filenames from my project.

        Project.pro

        # ----------------------------------------------------
        # This file is generated by the Qt Visual Studio Tools.
        # ------------------------------------------------------
        
        TEMPLATE = app
        TARGET = PROJECT
        DESTDIR = ../../Debug
        CONFIG += debug console
        DEFINES += PROJECT_DEF
        INCLUDEPATH += ./../../PROJECT \
            ./GeneratedFiles \
            $(NOINHERIT)
        LIBS += -L"." \
            -lShlwapi \
            -lAdvapi32 \
            -lWs2_32
        PRECOMPILED_HEADER = "./utils/Includes.h"
        DEPENDPATH += .
        MOC_DIR += ./GeneratedFiles
        OBJECTS_DIR += debug
        UI_DIR += .
        RCC_DIR += ./%(RootDir)%(Directory)
        #Edited
        HEADERS += .. 
        #Edited
        SOURCES += ..
        #Edited
        FORMS += ..
        RESOURCES += ../Resources/Resources.qrc
        

        Greetings
        betaros

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 3 May 2017, 20:58 last edited by
          #4

          Sorry, I almost never think of the use of the Visual Studio integration. Try adding /DNOMINMAX to your project defines.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • B Offline
            B Offline
            betaros
            wrote on 4 May 2017, 06:34 last edited by
            #5

            @SGaist: No problem :) I have solved the problem by finding a point in the source code where the preprocessor overrides the max function...

            Now it finds the right max function. But thank you for your help :)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 4 May 2017, 17:59 last edited by
              #6

              It was in your sources ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • B Offline
                B Offline
                betaros
                wrote on 5 May 2017, 10:51 last edited by
                #7

                Yes. I got a big codebase and try to compile it. I got the error because in the defines was something written like:

                #define max(x,y) qMax(x,y)
                

                Removing that resolved the probem.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 5 May 2017, 20:57 last edited by
                  #8

                  Tricky one !

                  Thanks for sharing :)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  1/8

                  2 May 2017, 10:37

                  • Login

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