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

Vadim Peretokin vperetokin at gmail.com
Wed Jul 24 21:39:40 CEST 2019


On Wed, Jul 24, 2019 at 11:38 AM Giuseppe D'Angelo via Interest <
interest at qt-project.org> wrote:

> 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.
>
>
That was it! Thanks for the detailed explanation. Removing the 'using
namespace std;' did the trick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190724/50a98812/attachment.html>


More information about the Interest mailing list