[Interest] error: reference to 'byte' is ambiguous with C++17

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Jul 24 11:37:36 CEST 2019


Il 24/07/19 09:25, Vadim Peretokin ha scritto:
> I'm compiling my Qt application with C++17 on Windows with the 
> Qt-provided MinGW 7.3.0 and the Qt definition of a byte is conflicting 
> with the new one defined in the standard (http://wg21.link/p0298r3).
> 
> Here's a snippet of the issue: https://paste.ubuntu.com/p/Y73FRVqq2n/
> 
> Full build log: 
> https://ci.appveyor.com/project/Mudlet/mudlet/builds/26199708
> 
> What's the correct solution here?

As your log shows, that (re)definition of "byte" is coming from a MinGW 
header, and not Qt.

Given the definition in the Standard Library is in the namespace std, 
the only possibility for a clash is that there's a "using namespace 
std;" directive somewhere in your code (or in some other header you 
include; Qt does not have anything like that). The solution is, as 
usual, to drop such a directive.

This is the other side of the coin for "using namespace" directives: 
when names are added to those namespaces they may clash against existing 
code, destroying the isolation that namespaces offer in the first place.

HTH,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190724/17cb8429/attachment.bin>


More information about the Interest mailing list