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. including <Windows.h> gives error.
QtWS25 Last Chance

including <Windows.h> gives error.

Scheduled Pinned Locked Moved Solved General and Desktop
errorqt 6.3.0windows.h
4 Posts 3 Posters 2.5k 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.
  • B Offline
    B Offline
    BigBen
    wrote on 20 Jun 2022, 07:40 last edited by BigBen
    #1

    Hi.

    I am including the Windows.h header file in QtCreator, but I get the following error:

    In included file: reference to 'byte' is ambiguous
    

    I am not using using namespace std anywhere in my project.

    How can I resolve this error?

    J J 2 Replies Last reply 20 Jun 2022, 08:20
    0
    • B BigBen
      20 Jun 2022, 07:40

      Hi.

      I am including the Windows.h header file in QtCreator, but I get the following error:

      In included file: reference to 'byte' is ambiguous
      

      I am not using using namespace std anywhere in my project.

      How can I resolve this error?

      J Offline
      J Offline
      JonB
      wrote on 20 Jun 2022, 08:20 last edited by
      #2

      @BigBen
      Not sure where that is coming from, given that you say it's not to do with std::byte.

      Start by where do you #include <Windows.h> ? Try putting it before any other #includes, try putting it after all of them, any difference? Try a standalone program with just #include <Windows.h> initially, then add in various Qt includes. Doesn't the error message give any further details about where the error occurs, where byte is being defined? Etc.

      B 1 Reply Last reply 21 Jun 2022, 01:51
      0
      • B BigBen
        20 Jun 2022, 07:40

        Hi.

        I am including the Windows.h header file in QtCreator, but I get the following error:

        In included file: reference to 'byte' is ambiguous
        

        I am not using using namespace std anywhere in my project.

        How can I resolve this error?

        J Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 20 Jun 2022, 08:40 last edited by
        #3

        @BigBen said in including <Windows.h> gives error.:

        reference to 'byte' is ambiguous

        thats Microsofts fault their MSVC implementation of std::byte that came with c++17 is ds.

        you can, if you're not using byte in your user defined code add #define _HAS_STD_BYTE 0 before the problematic include, that should work.


        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.

        1 Reply Last reply
        3
        • J JonB
          20 Jun 2022, 08:20

          @BigBen
          Not sure where that is coming from, given that you say it's not to do with std::byte.

          Start by where do you #include <Windows.h> ? Try putting it before any other #includes, try putting it after all of them, any difference? Try a standalone program with just #include <Windows.h> initially, then add in various Qt includes. Doesn't the error message give any further details about where the error occurs, where byte is being defined? Etc.

          B Offline
          B Offline
          BigBen
          wrote on 21 Jun 2022, 01:51 last edited by
          #4

          @JonB Shifting it to before any other includes got rid of the error.

          There were no other details in the error messsage.

          1 Reply Last reply
          1

          1/4

          20 Jun 2022, 07:40

          • Login

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