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

K. Frank kfrank29.c at gmail.com
Tue Apr 16 13:34:55 CEST 2013


Hello Kai!

On Tue, Apr 16, 2013 at 2:53 AM, Koehne Kai <> wrote:
>
>> -----Original Message-----
>> [mailto:interest-bounces+kai.koehne=digia.com at qt-project.org] On Behalf
>> Of K. Frank
>> [...]
>> I also have the concern that if I do turn off c++11 when building QtScript /
>> QtWebKit, even if the Qt build succeeds, I would still expect compiling any of
>> my own code that jointly uses c++11 and QtScript / QtWebKit to fail because I
>> am seeing the compilation errors in the header files.  Is this a legitimate
>> concern?  If so, is there some way I might work around it?
>
> 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.

Again, I understand the suggestion that I should be able to compile my
app with -std=c++11 against stock QtScript/QtWebKit, but would that
still be true if my app uses QtScript and/or QtWebKit?

>> One more note:  I ran configure with "-no-webkit".  Do you think that if I also
>> add "-no-script" to my configure that I will be able to build Qt with c++11
>> turned on?
>>
>> I haven't (explicitly) used QtScript.  What would I be giving up if I turned it
>> off?
>
> e.g. QtDeclarative won't compile then.

Ah, okay.  Do you know if anything else is mixed in with this?  Would I
expect to be able to build successfully with -std=c++11 if I configured
with:

   -no-webkit -no-script -no-declarative

(obviously forgoing that functionality), or is there more I would have to
turn off?


Thanks for helping me sort this stuff out.


K. Frank



More information about the Interest mailing list