UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit
-
While running an application, occurred following errors, pls help to solve this
I tried to run in Qt creator and VS2019 Qt extension, in both cases same error occurredC:\Qt6\6.3.0\msvc2019_64\include\QtCore\qhashfunctions.h:94: error: C3861: 'UINT32_C': identifier not found
C:\Qt6\6.3.0\msvc2019_64\include\QtCore\qhashfunctions.h:104: error: C3861: 'UINT64_C': identifier not foundQt version: Qt6.3.0 MSVC2019 64-bit
VS 2019 is installed
OS is Windows10 -
While running an application, occurred following errors, pls help to solve this
I tried to run in Qt creator and VS2019 Qt extension, in both cases same error occurredC:\Qt6\6.3.0\msvc2019_64\include\QtCore\qhashfunctions.h:94: error: C3861: 'UINT32_C': identifier not found
C:\Qt6\6.3.0\msvc2019_64\include\QtCore\qhashfunctions.h:104: error: C3861: 'UINT64_C': identifier not foundQt version: Qt6.3.0 MSVC2019 64-bit
VS 2019 is installed
OS is Windows10UINTxx_C is defined in stdint.h - add this include in qhashfunctions.h and see if it helps.
-
@hstg
Well the issue you report --- that error message --- cannot persist ifstdint.hdoes indeed defineUINTxx_C; and- you include
stdint.hat the right place, i.e. prior to to whatever causesqhashfunctions.hto be included (which may be indirectly via some other#include), or inqhashfunctions.hitself.
So what exactly did you put where?
-
@hstg
Well the issue you report --- that error message --- cannot persist ifstdint.hdoes indeed defineUINTxx_C; and- you include
stdint.hat the right place, i.e. prior to to whatever causesqhashfunctions.hto be included (which may be indirectly via some other#include), or inqhashfunctions.hitself.
So what exactly did you put where?
-
Hello!
@JonB is right. You need to include
#include <stdint.h>to get access toUINTxx_C(UINT32_C, UINT64_C). You can try it usingVS 2019with a test example project.#include <stdint.h> int main() { UINT32_C(0x45d9f3b); UINT64_C(0xd6e8feb86659fd93); return 0; }In my case it reports the following:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========Additionally, I would suggest to have the
#include <Windows.h>included there as well. -
Hello!
@JonB is right. You need to include
#include <stdint.h>to get access toUINTxx_C(UINT32_C, UINT64_C). You can try it usingVS 2019with a test example project.#include <stdint.h> int main() { UINT32_C(0x45d9f3b); UINT64_C(0xd6e8feb86659fd93); return 0; }In my case it reports the following:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========Additionally, I would suggest to have the
#include <Windows.h>included there as well.@Cobra91151 said in UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit:
UINT32_C(0x45d9f3b); UINT64_C(0xd6e8feb86659fd93);@Cobra91151
Many thanks for your help!
but i have added it , still get error as belowI use qt6.4 static build


if i use QT 5.15.6 , it is ok. only QT6 got this error
-
@Cobra91151 said in UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit:
UINT32_C(0x45d9f3b); UINT64_C(0xd6e8feb86659fd93);@Cobra91151
Many thanks for your help!
but i have added it , still get error as belowI use qt6.4 static build


if i use QT 5.15.6 , it is ok. only QT6 got this error
Some good practices:
Don't modify Qt files unless you have to. It's a maintenance burden and has licensing implications
Don't include Windows.h unless you have a specific reason. You don't have a reason here. Those types are not Windows specific. Certainly don't put Windows.h in Qt headers.
Don't include C headers when there's a C++ header available i.e. use<cstdint>instead of<stdint.h>. It will include the C header transitively if needed.As for the problem - put
#include <cstdint>in your source file above any Qt includes that cause this error. Better yet, if you're using precompiled headers put it there. -
Some good practices:
Don't modify Qt files unless you have to. It's a maintenance burden and has licensing implications
Don't include Windows.h unless you have a specific reason. You don't have a reason here. Those types are not Windows specific. Certainly don't put Windows.h in Qt headers.
Don't include C headers when there's a C++ header available i.e. use<cstdint>instead of<stdint.h>. It will include the C header transitively if needed.As for the problem - put
#include <cstdint>in your source file above any Qt includes that cause this error. Better yet, if you're using precompiled headers put it there.@Chris-Kawa
many thanks for your suggestion . i have changed it as per your suggestion.
Thanks a lot of.include <cstdint> is same the error.
then i copy
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64in my app h file
it is ok
-
@tigerlfj That's weird. It means something is undefining them or you have some defines that disable them. I'm glad you found a workaround, but that's not a proper solution. I would check if you have any defines or compiler switches set that would affect it.
-
@Cobra91151 said in UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit:
UINT32_C(0x45d9f3b); UINT64_C(0xd6e8feb86659fd93);@Cobra91151
Many thanks for your help!
but i have added it , still get error as belowI use qt6.4 static build


if i use QT 5.15.6 , it is ok. only QT6 got this error
I had the same problem with QZXing builds, but was able to solve it in the following way.
-
Add the following records to the
.profile and buildQMAKE_CXXFLAGS += -POutput
.ifiles corresponding to the source files -
Check the output
.ifile (e.g.Result.i).
stdint.his not VC butsrc\zxing\win32\zxing\msvc\stdint.hof ZXing is included. -
Check the included
stdint.hof ZXing.
The following directive are found in the relevant macro definition section.#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) -
Add the following record to the ".pro" file and build.
DEFINES += __STDC_LIMIT_MACROS
-