Switched from Qt 5 to Qt 6
-
"Hello everyone,
I am coding in C++/Qt, and I just switched from Qt 5 to Qt 6. Besides the numerous errors I've already fixed, there is one error that I don't understand, and it's the following:"1 - C:\Qt\Tools\mingw1310_64\x86_64-w64-mingw32\include\objidlbase.h:2026: erreur : 'byte' has not been declared In file included from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/combaseapi.h:155, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/objbase.h:14, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/ole2.h:17, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/wtypes.h:13, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/winscard.h:10, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/windows.h:97, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/winsock2.h:23, from C:/Data/Fichiers_applications/C++/LibrairiesExternes/curl-8.8.0_1-win64-mingw/include/curl/curl.h:73, from ..\..\Facturation\../Gestion/libcurlmodifiee.h:7, from ..\..\Facturation\fen_de_facturation.h:51, from ..\..\Facturation\fen_de_facturation.cpp:1: C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/objidlbase.h:2026:5: error: 'byte' has not been declared 2026 | byte *pv, 2 - C:\Qt\Tools\mingw1310_64\x86_64-w64-mingw32\include\objidlbase.h:2026: erreur : reference to 'byte' is ambiguous In file included from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/combaseapi.h:155, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/objbase.h:14, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/ole2.h:17, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/wtypes.h:13, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/winscard.h:10, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/windows.h:97, from C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/winsock2.h:23, from C:/Data/Fichiers_applications/C++/LibrairiesExternes/curl-8.8.0_1-win64-mingw/include/curl/curl.h:73, from ..\..\Facturation\../Gestion/libcurlmodifiee.h:7, from ..\..\Facturation\fen_de_facturation.h:51, from ..\..\Facturation\fen_de_facturation.cpp:1: C:/Qt/Tools/mingw1310_64/x86_64-w64-mingw32/include/objidlbase.h:2026:5: error: reference to 'byte' is ambiguous 2026 | byte *pv,if anyone can help me please.
Thanks in advance to all. -
That's probably due to a change in the C++ version.
Check your headers forusing namespace stdand remove it. -
To add on to @Axel-Spoerl
std::byte is a thing since c++17
I think Qt6 requires c++17 now by default ? Anyway in your own code you have somewhere a byte type and the compiler is now confusing those too
Pro tipp namespaces are a thing use them :p
I had the same issue where I had a byte(order) enum type that caused all kind of problems, changed it to a capital B and that solved it.
-
Hello,
Thank you 'Hilk' for your response. I will test that this weekend and will keep you updated.