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. 'byte': ambiguous symbol when building with QT6
Forum Updated to NodeBB v4.3 + New Features

'byte': ambiguous symbol when building with QT6

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 5 Posters 3.8k 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.
  • K Offline
    K Offline
    KJ92
    wrote on last edited by
    #1

    Hi,
    We updated our QT to 6 and building msvc compiler generates this error:

    \Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(203): error C2872: 'byte': ambiguous symbol
     C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(202): note: could be 'unsigned char byte'
     C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.34.31933\include\cstddef(28): note: or       'std::byte'
    

    Seems like it's an open bug on MSFT "https://developercommunity.visualstudio.com/t/error-c2872-byte-ambiguous-symbol/93889"

    How does QT team suggest to handle this?
    We don't use byte in our code.

    Christian EhrlicherC 1 Reply Last reply
    0
    • K KJ92

      Hi,
      We updated our QT to 6 and building msvc compiler generates this error:

      \Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(203): error C2872: 'byte': ambiguous symbol
       C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(202): note: could be 'unsigned char byte'
       C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.34.31933\include\cstddef(28): note: or       'std::byte'
      

      Seems like it's an open bug on MSFT "https://developercommunity.visualstudio.com/t/error-c2872-byte-ambiguous-symbol/93889"

      How does QT team suggest to handle this?
      We don't use byte in our code.

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

      Where exactly does it happen? Please provide a minimal, compilable example. Also what Qt version do you use and did try the workarounds mentioned in the bug report?

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

      K 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Where exactly does it happen? Please provide a minimal, compilable example. Also what Qt version do you use and did try the workarounds mentioned in the bug report?

        K Offline
        K Offline
        KJ92
        wrote on last edited by KJ92
        #3

        @Christian-Ehrlicher Im trying to compile my application using QT6 that is compiled from source.

        when i compile my application i get 'byte': ambiguous symbol.
        There is a conflict in SDK 10 files and MSVC2022 where are both a requirement by QT website.

        The workaround worked for me(changing from byte to BYTE in the SDK).
        But that will make us do the workaround on all our systems. also when updating the SDK.

        My question is if QT team knows about this issue and what is their suggestion.

        J.HilkJ JonBJ 2 Replies Last reply
        0
        • K KJ92

          @Christian-Ehrlicher Im trying to compile my application using QT6 that is compiled from source.

          when i compile my application i get 'byte': ambiguous symbol.
          There is a conflict in SDK 10 files and MSVC2022 where are both a requirement by QT website.

          The workaround worked for me(changing from byte to BYTE in the SDK).
          But that will make us do the workaround on all our systems. also when updating the SDK.

          My question is if QT team knows about this issue and what is their suggestion.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @KJ92 This is not a problem of the Qt code base. You have somewhere in your own project code byte defined, That one is now conflicting with the newer SDK.

          I had this too, once I changed my enum to Byte from byte, it compiled just fine.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          K 1 Reply Last reply
          0
          • K KJ92

            @Christian-Ehrlicher Im trying to compile my application using QT6 that is compiled from source.

            when i compile my application i get 'byte': ambiguous symbol.
            There is a conflict in SDK 10 files and MSVC2022 where are both a requirement by QT website.

            The workaround worked for me(changing from byte to BYTE in the SDK).
            But that will make us do the workaround on all our systems. also when updating the SDK.

            My question is if QT team knows about this issue and what is their suggestion.

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

            @KJ92 said in 'byte': ambiguous symbol when building with QT6:

            My question is if QT team knows about this issue and what is their suggestion.

            There are at least 4 workarounds suggested in the link you referenced. One of which you seem to have adopted.

            But that will make us do the workaround on all our systems. also when updating the SDK.

            What are you saying you need to do "when updating the SDK"? If you are saying you have made any change to the supplied header files I see nothing which suggests you do that.

            If you are trying to make the minimum change possible the final solution there suggests

            #define _HAS_STD_BYTE 0 before any includes: Works ok.

            If you do your includes in only one/common place this seems easy if it works.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SimonSchroeder
              wrote on last edited by
              #6

              One more thing to consider is that it does find std::byte. Do you have using namespace std; somewhere? I am not sure how else it would find std::byte.

              1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                @KJ92 This is not a problem of the Qt code base. You have somewhere in your own project code byte defined, That one is now conflicting with the newer SDK.

                I had this too, once I changed my enum to Byte from byte, it compiled just fine.

                K Offline
                K Offline
                KJ92
                wrote on last edited by KJ92
                #7

                @J-Hilk said in 'byte': ambiguous symbol when building with QT6:

                base. You have somewhere in your own project code byte defined, That one is now conflicting with the newer SDK.
                I had this too, once I changed my enum to Byte from byte, it compiled just fine.

                We don't use byte in our code .

                @JonB said in 'byte': ambiguous symbol when building with QT6:

                What are you saying you need to do "when updating the SDK"? If you are saying you have made any change to the supplied header files I see nothing which suggests you do that.

                One of the suggestion(which is the only solution that resolved my problem) is to change the byte in windows SDK "Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h" file to BYTE.

                @JonB said in 'byte': ambiguous symbol when building with QT6:

                If you are trying to make the minimum change possible the final solution there suggests

                This solution wont work. its disabling byte of the STL and QT is using this byte .

                @JonB said in 'byte': ambiguous symbol when building with QT6:

                If you do your includes in only one/common place this seems easy if it works.

                we have a big project its not possible to do all the includes in one place.

                @SimonSchroeder Yes we have the using namestpace std;
                but we are not using byte in our code

                JonBJ 1 Reply Last reply
                0
                • K KJ92

                  @J-Hilk said in 'byte': ambiguous symbol when building with QT6:

                  base. You have somewhere in your own project code byte defined, That one is now conflicting with the newer SDK.
                  I had this too, once I changed my enum to Byte from byte, it compiled just fine.

                  We don't use byte in our code .

                  @JonB said in 'byte': ambiguous symbol when building with QT6:

                  What are you saying you need to do "when updating the SDK"? If you are saying you have made any change to the supplied header files I see nothing which suggests you do that.

                  One of the suggestion(which is the only solution that resolved my problem) is to change the byte in windows SDK "Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h" file to BYTE.

                  @JonB said in 'byte': ambiguous symbol when building with QT6:

                  If you are trying to make the minimum change possible the final solution there suggests

                  This solution wont work. its disabling byte of the STL and QT is using this byte .

                  @JonB said in 'byte': ambiguous symbol when building with QT6:

                  If you do your includes in only one/common place this seems easy if it works.

                  we have a big project its not possible to do all the includes in one place.

                  @SimonSchroeder Yes we have the using namestpace std;
                  but we are not using byte in our code

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

                  @KJ92 said in 'byte': ambiguous symbol when building with QT6:

                  @SimonSchroeder Yes we have the using namestpace std;
                  but we are not using byte in our code

                  I am not sure about this, but where do you place that statement relative to the includes of those files? Is it before the #includes? If so, can you try moving it to after to see if that resolves?

                  K 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @KJ92 said in 'byte': ambiguous symbol when building with QT6:

                    @SimonSchroeder Yes we have the using namestpace std;
                    but we are not using byte in our code

                    I am not sure about this, but where do you place that statement relative to the includes of those files? Is it before the #includes? If so, can you try moving it to after to see if that resolves?

                    K Offline
                    K Offline
                    KJ92
                    wrote on last edited by
                    #9

                    @JonB said in 'byte': ambiguous symbol when building with QT6:

                    I am not sure about this, but where do you place that statement relative to the includes of those files? Is it before the #includes? If so, can you try moving it to after to see if that resolves?

                    In each file we have the using namespace std its after the includes

                    JonBJ 1 Reply Last reply
                    0
                    • K KJ92

                      @JonB said in 'byte': ambiguous symbol when building with QT6:

                      I am not sure about this, but where do you place that statement relative to the includes of those files? Is it before the #includes? If so, can you try moving it to after to see if that resolves?

                      In each file we have the using namespace std its after the includes

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

                      @KJ92
                      Then I wonder which line of your code compiler is in when it generates:

                      Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(203): error C2872: 'byte': ambiguous symbol

                      ? @Christian-Ehrlicher asked earlier for a minimal compliable example of the error. And that does mean minimal.

                      K 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @KJ92
                        Then I wonder which line of your code compiler is in when it generates:

                        Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\rpcndr.h(203): error C2872: 'byte': ambiguous symbol

                        ? @Christian-Ehrlicher asked earlier for a minimal compliable example of the error. And that does mean minimal.

                        K Offline
                        K Offline
                        KJ92
                        wrote on last edited by
                        #11

                        @JonB after i removed all the using namespace std instances from all my code the problem is gone but this means that the library is setting a policy for the program.

                        Thought about defining my own header in QT sources that will have the definition of byte and then including this header at the beginning of the QT program.
                        Is this possible? Do you know in which file i need to add this header?

                        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