[Interest] Several issues compiling Qt 4.8.4 with mingw-w64 4.8.1, possible related to "-std=gnu++11"

Andreas Pakulat apaku at gmx.de
Tue Apr 16 15:31:55 CEST 2013


Hi,

On Tue, Apr 16, 2013 at 1:34 PM, K. Frank <kfrank29.c at gmail.com> wrote:

> Hello Kai!
>
> On Tue, Apr 16, 2013 at 2:53 AM, Koehne Kai <> wrote:
> > Actually I'd expect that to work just fine. The commonly reported issue
> with mixing e.g. -std=c++11 and -std=gnu++98 (the default) is ABI changes
> in the std:: namespace. Since Qt does use it only sparingly, and in inline
> methods, IMO you should be fine compiling your app with e.g. std=c++11 and
> still compile against stock QtScript/QtWebKit.
>
> I'd like to follow up on this because I don't fully understand.
>
> First, I understand that Qt's limited usage of the std namespace means
> (hopefully) that it avoids the ABI differences between -std=c++11 and
> -std=gnu++98.
>
> My concern is the header files.  When I compile my code that uses
> Qt (whether or not the Qt libraries compiled or whether or not there
> is an ABI issue), I include various headers for the Qt features I am
> using.  I haven't traced through which Qt headers include which other
> Qt headers, but, in general, including a top-level "user" header pulls
> in a number of supporting headers.
>
> Many of the -std=c++11 compile errors I saw were in headers.  For
> example, the swap issue occurs in HashTable.h (included, indirectly,
> in the Qt build process first by JSBase.cpp).  Similarly, the signbit
> issue occurs in JSImmediate.h.
>
> My expectation is that my code that uses QtScript, for example,
> that also uses -std=c++11, would be likely to include (indirectly)
> headers like HashTable.h and JSImmediate.h, and would therefore
> fail to compile.
>
> I suppose it's possible that any problematic headers might only be
> used for building the Qt libraries, and never get pulled into user code,
> but unless Qt were specifically designed that way, it seems unlikely.
>

Actually, Qt is designed specifically for that. Just look at all the
various _p.h header files and Private*-members. You don't get to see these
from your apps code since its all hidden away and Qt tries very hard to
only expose intended public API in its public headers.

In particular QtScript and QtWebKit do not expose the headers/API of the JS
engine they use, except through Q* classes. So all those issues above will
not surface by just including all public headers of QtScript/QtWebkit in
your app.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130416/5c63b2b4/attachment.html>


More information about the Interest mailing list