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. Compile error with std::bitset and Qt in VS2017
Forum Update on Monday, May 27th 2025

Compile error with std::bitset and Qt in VS2017

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 819 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.
  • J Offline
    J Offline
    johnyang
    wrote on 6 Apr 2020, 01:32 last edited by
    #1

    I am using Qt5.12.7 and VS2017. I have some legacy code that is using std::bitset and the compiler is throwing the same 'operator /' error reported in https://bugreports.qt.io/browse/QTBUG-72073

    Currently I managed to bypass the problem by changing the bitset file in VS2017 as suggested in one of the comment at the above link:
    Replace all "_Pos / _Bitsperword" with "_Pos / size_t(_Bitsperword)" in C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include\bitset

    Is there better way or official fix to solve this issue? I noticed it seems being reported and fixed in VS2019. The bug report above seems suggesting it has been fixed but I'm still running into the same problem in the latest LTS Qt version and latest VS2017.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 6 Apr 2020, 06:46 last edited by
      #2

      The bugreport contains a fix - did you try it?

      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
      0
      • J Offline
        J Offline
        johnyang
        wrote on 6 Apr 2020, 23:18 last edited by johnyang 4 Jun 2020, 23:21
        #3

        @Christian-Ehrlicher Do you mean QT_NO_FLOAT16_OPERATORS? How to use this fix?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 7 Apr 2020, 06:19 last edited by
          #4

          @johnyang said in Compile error with std::bitset and Qt in VS2017:

          How to use this fix?

          Apply the patch to your Qt sources. If you don't compile from sources then you only have to apply the changes for qfloat16.h

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

          J 1 Reply Last reply 9 Apr 2020, 00:52
          0
          • C Christian Ehrlicher
            7 Apr 2020, 06:19

            @johnyang said in Compile error with std::bitset and Qt in VS2017:

            How to use this fix?

            Apply the patch to your Qt sources. If you don't compile from sources then you only have to apply the changes for qfloat16.h

            J Offline
            J Offline
            johnyang
            wrote on 9 Apr 2020, 00:52 last edited by
            #5

            @Christian-Ehrlicher said in Compile error with std::bitset and Qt in VS2017:

            qfloat16.h

            It looks like the latest 5.12.7 has the updated qflaot16.h with QT_NO_FLOAT16_OPERATORS lines. But how to use it? I need to define QT_NO_FLOAT16_OPERATORS somewhere in my source code or where the bitset is being used?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 9 Apr 2020, 07:43 last edited by Christian Ehrlicher 4 Sept 2020, 07:44
              #6

              You don't need anything - simply use 5.12.7 and you're fine. If you still have some problems you for sure don't use 5.12.7 I would guess - you can simply see if you've the correct version by looking into qfloat16.h and see if the patch is in.

              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
              0

              1/6

              6 Apr 2020, 01:32

              • Login

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