[Interest] Compiling Programs with C++11 with Qt5, which was compiled without C++11 flag. Possible?

Sze Howe Koh szehowe.koh at gmail.com
Sat Aug 17 03:01:35 CEST 2013


On 15 August 2013 23:13, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On quinta-feira, 15 de agosto de 2013 16:07:33, Sze Howe Koh wrote:
>> On 15 August 2013 12:53, Thiago Macieira <thiago.macieira at intel.com> wrote:
>> > However, the error about "complex" makes me thing it's actually the
>> > capital
>> > letter I, defined in complex.h.
>> >
>> > Since C99 requires that definition (7.3.1p4), looks like we should simply
>> > change Qt.
>>
>> I believe "I" is only defined in C99, but not C++ (well, at least my
>> MSVC2010 headers don't have it)
>
> Correct. And I've just checked the latest draft for C++14 and it does not
> define I. In fact, it does not allow the C99 complex types at all:
>
>         _Complex double j;
>
> I asked the committee in May about more C99 rapprochement and the above is
> exactly one of the things they do *not* want. That above is C99's way of doing
> something C++ solved with templates.
>
>> > the problem is not those patches. It's that he #included
>> > <complex.h> before <qobject.h>
>>
>> It turns out that the problem is he defined "I" in one of his own
>> headers before including qobject.h:
>> http://qt-project.org/forums/viewthread/31105/
>
> Right. But still, since C99 does define I in complex.h and some compilers do
> allow including C99 headers in C++ code, we need to cope with it.
>
> Does anyone want to submit a simple patch that renames the template parameter?

https://codereview.qt-project.org/#change,63221


Sze-Howe



More information about the Interest mailing list