QDeadLineTimer - error C2039: max is no member of std::numeric_limits
-
wrote on 2 May 2017, 10:37 last edited by betaros 5 Feb 2017, 10:38
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 -
Hi and welcome to devnet,
Can you share your .pro file ?
-
wrote on 3 May 2017, 07:22 last edited by
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.
# ---------------------------------------------------- # 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 -
Sorry, I almost never think of the use of the Visual Studio integration. Try adding
/DNOMINMAX
to your project defines. -
It was in your sources ?
-
wrote on 5 May 2017, 10:51 last edited by
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.
-
Tricky one !
Thanks for sharing :)
1/8