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. Programmatically determine if processor is 64-bit using Qt code

Programmatically determine if processor is 64-bit using Qt code

Scheduled Pinned Locked Moved General and Desktop
7 Posts 7 Posters 2.9k 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.
  • C Offline
    C Offline
    cyao
    wrote on 1 Nov 2012, 21:05 last edited by
    #1

    Hi, is there anybody can tell me how to programmaticall determine if the processor is 64-bit or 32-bit by calling some Qt class method. I looked into QSysInfo, but it can only tell OS version.

    Thanks!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on 1 Nov 2012, 22:15 last edited by
      #2

      It's purely OS based how this data is acquired.
      So you'll need to use different functions based on OS. Those are not provided by Qt.

      And even with that, you'll get only if OS is 32 or 64-bit, not the processor.

      Regards,
      Jake


      Code is poetry

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on 1 Nov 2012, 23:08 last edited by
        #3

        [quote author="Jake007" date="1351808156"]It's purely OS based how this data is acquired.
        So you'll need to use different functions based on OS. Those are not provided by Qt.
        [/quote]

        Jake007 is right. That functionality depends on your OS' native API.

        "You may try this link ":http://vcpptips.wordpress.com/tag/computer-is-running-a-32-bit-or-64-bit-os/

        The author shows 3 ways to do it in windows.

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on 2 Nov 2012, 10:02 last edited by
          #4

          You can check the size of a pointer to find out whether the application is using 32bit or 64bit. That may or may not be what you want to know though:-)

          1 Reply Last reply
          0
          • I Offline
            I Offline
            issam
            wrote on 2 Nov 2012, 14:08 last edited by
            #5

            bq. It’s purely OS based how this data is acquired.
            So you’ll need to use different functions based on OS. Those are not provided by Qt.

            So, you can use QProcess ;)
            On Linux :

            @uname -m@
            and
            @arch @

            return x86_64 if the CPU is 64bit otherwise it returns i386/i586/i686 !

            You have the doc !
            and... use your imagination :)

            http://www.iissam.com/

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Sprezzatura
              wrote on 14 Apr 2021, 16:52 last edited by
              #6

              Use:

              QSysInfo::buildAbi();
              

              Returns something like x86_64-little_endian-llp64 or i386-little_endian-ilp32

              1 Reply Last reply
              1
              • J Offline
                J Offline
                JoeCFD
                wrote on 14 Apr 2021, 17:28 last edited by JoeCFD
                #7

                Sprezzatura is right. Check this out.
                https://doc.qt.io/archives/qt-5.9/qsysinfo.html#buildAbi
                https://doc.qt.io/qt-5/qsysinfo.html#buildAbi

                1 Reply Last reply
                0

                • Login

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