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

Thiago Macieira thiago.macieira at intel.com
Thu Aug 15 17:13:53 CEST 2013


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?


-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130815/ee4a130f/attachment.sig>


More information about the Interest mailing list