How to solve the problem C++17 std::byte and win sdk byte namespace ambigus
-
when i used the windows sdk then i found the byte defined named ambigus.
some one told me about "_HAS_STD_BYTE=0"
but i pressed the code seemed dosent work.
So how to solve it?
By the way,Im using the qt5.14&mingw32 compile program. -
@nicker-player
Somebody asked this question recently. I suggested they try putting the#include <windows.h>
directive as the very first line in whichever.cpp
file(s), before including any Qt stuff. And they said that worked, try it?
Ahh, found page: https://forum.qt.io/topic/137337/including-windows-h-gives-error -
@JonB
In fact it dosent work
I put the code with config += c++17 alone with the single project it could run.So i think it not the major reason.
When i messured these codes into the whole project,It cames the bugs of ambigus.
Cause i dont know where I included the wrong head files ,so many files to lookfor .And in fact i dont know how to solve the problem in your way|....... -
@nicker-player said in How to solve the problem C++17 std::byte and win sdk byte namespace ambigus:
In fact it dosent work
Well it worked for the other person. I don't see any relevance to c++17. Did you even try what I said about the
#include <windows.h>
, because you do not say anything about that? -
@nicker-player said in How to solve the problem C++17 std::byte and win sdk byte namespace ambigus:
And i dont know where to fix the include <windows.h>
I said to you: before anything Qt is included. That would be for
<windows.h>
or for whatever you use which could include that, such as whatever you include for7z.dll
, which you do not mention. -
@nicker-player said in How to solve the problem C++17 std::byte and win sdk byte namespace ambigus:
I put the <windows.h> into the preheader file of the project.
No
In the file where you have#include <windows.h>
make sure it is above any Qt header includes.