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. UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit
Forum Updated to NodeBB v4.3 + New Features

UINT32_C' & 'UINT64_C': identifier not found error in Qt6.3.0 MSVC2019 64-bit

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 7 Posters 2.5k Views 2 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.
  • H Offline
    H Offline
    hstg
    wrote on last edited by
    #1

    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 occurred

    C:\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 found

    Qt version: Qt6.3.0 MSVC2019 64-bit
    VS 2019 is installed
    OS is Windows10

    Christian EhrlicherC 1 Reply Last reply
    0
    • H hstg

      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 occurred

      C:\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 found

      Qt version: Qt6.3.0 MSVC2019 64-bit
      VS 2019 is installed
      OS is Windows10

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      UINTxx_C is defined in stdint.h - add this include in qhashfunctions.h and see if it helps.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • H Offline
        H Offline
        hstg
        wrote on last edited by
        #3

        I tried that also but the issue still persist

        JonBJ 1 Reply Last reply
        0
        • H hstg

          I tried that also but the issue still persist

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @hstg
          Well the issue you report --- that error message --- cannot persist if

          • stdint.h does indeed define UINTxx_C; and
          • you include stdint.h at the right place, i.e. prior to to whatever causes qhashfunctions.h to be included (which may be indirectly via some other #include), or in qhashfunctions.h itself.

          So what exactly did you put where?

          T 1 Reply Last reply
          0
          • JonBJ JonB

            @hstg
            Well the issue you report --- that error message --- cannot persist if

            • stdint.h does indeed define UINTxx_C; and
            • you include stdint.h at the right place, i.e. prior to to whatever causes qhashfunctions.h to be included (which may be indirectly via some other #include), or in qhashfunctions.h itself.

            So what exactly did you put where?

            T Offline
            T Offline
            tigerlfj
            wrote on last edited by
            #5

            @JonB no effect in QT6.4 VS2019 WINDOWS11 .

            Cobra91151C 1 Reply Last reply
            0
            • T tigerlfj

              @JonB no effect in QT6.4 VS2019 WINDOWS11 .

              Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by
              #6

              @tigerlfj

              Hello!

              @JonB is right. You need to include #include <stdint.h> to get access to UINTxx_C (UINT32_C, UINT64_C). You can try it using VS 2019 with 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.

              T 1 Reply Last reply
              0
              • Cobra91151C Cobra91151

                @tigerlfj

                Hello!

                @JonB is right. You need to include #include <stdint.h> to get access to UINTxx_C (UINT32_C, UINT64_C). You can try it using VS 2019 with 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.

                T Offline
                T Offline
                tigerlfj
                wrote on last edited by tigerlfj
                #7

                @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 below

                I use qt6.4 static build

                641123d6-89a7-4e47-983f-5fb04e911505-image.png

                93479070-02eb-4152-afbc-bb94902ec28e-image.png

                if i use QT 5.15.6 , it is ok. only QT6 got this error

                Chris KawaC C 2 Replies Last reply
                0
                • T tigerlfj

                  @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 below

                  I use qt6.4 static build

                  641123d6-89a7-4e47-983f-5fb04e911505-image.png

                  93479070-02eb-4152-afbc-bb94902ec28e-image.png

                  if i use QT 5.15.6 , it is ok. only QT6 got this error

                  Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by Chris Kawa
                  #8

                  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.

                  T 1 Reply Last reply
                  2
                  • Chris KawaC Chris Kawa

                    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.

                    T Offline
                    T Offline
                    tigerlfj
                    wrote on last edited by tigerlfj
                    #9

                    @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##ui64

                    in my app h file

                    it is ok

                    1 Reply Last reply
                    0
                    • Chris KawaC Offline
                      Chris KawaC Offline
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @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.

                      1 Reply Last reply
                      0
                      • T tigerlfj

                        @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 below

                        I use qt6.4 static build

                        641123d6-89a7-4e47-983f-5fb04e911505-image.png

                        93479070-02eb-4152-afbc-bb94902ec28e-image.png

                        if i use QT 5.15.6 , it is ok. only QT6 got this error

                        C Offline
                        C Offline
                        c-toyama
                        wrote on last edited by
                        #11

                        @tigerlfj

                        I had the same problem with QZXing builds, but was able to solve it in the following way.

                        1. Add the following records to the .pro file and build

                          QMAKE_CXXFLAGS += -P
                          

                          Output .i files corresponding to the source files

                        2. Check the output .i file (e.g. Result.i).
                          stdint.h is not VC but src\zxing\win32\zxing\msvc\stdint.h of ZXing is included.

                        3. Check the included stdint.h of ZXing.
                          The following directive are found in the relevant macro definition section.

                          #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
                          
                        4. Add the following record to the ".pro" file and build.

                          DEFINES += __STDC_LIMIT_MACROS
                          
                        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