including <Windows.h> gives error.
-
wrote on 20 Jun 2022, 07:40 last edited by BigBen
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?
-
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?
wrote on 20 Jun 2022, 08:20 last edited by@BigBen
Not sure where that is coming from, given that you say it's not to do withstd::byte
.Start by where do you
#include <Windows.h>
? Try putting it before any other#include
s, 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, wherebyte
is being defined? Etc. -
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?
@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. -
@BigBen
Not sure where that is coming from, given that you say it's not to do withstd::byte
.Start by where do you
#include <Windows.h>
? Try putting it before any other#include
s, 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, wherebyte
is being defined? Etc.
1/4