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 Updated to NodeBB v4.3 + New Features

Compile error with std::bitset and Qt in VS2017

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 821 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 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
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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 last edited by johnyang
        #3

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

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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
          0
          • Christian EhrlicherC Christian Ehrlicher

            @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 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
            • Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #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

              • Login

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