[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 06:53:04 CEST 2013


On quinta-feira, 15 de agosto de 2013 04:21:47, Guido Seifert wrote:
> > First of all, a screenshot of compilation errors? Yuck! Compilation errors
> > are text. A text pastebin is better.
> 
> Seems to be frowned on on SO. Never seen a pastebin there. But I am not that
> long active there.

Indeed. For emails and StackOverflow, you can just paste the actual error 
messages in the editor. No need for screenshots either.

The only reason to screenshot text is when you're trying to show a problem 
with text rendering. Otherwise, copy & paste.

(And if you're copying from a Windows command-prompt, please fix the line 
breaks)

> > Third, errors that make no sense at first glance are usually the result of
> > preprocessing errors. The most likely case is that someone #define'd
> > Function.
> According to him, he now can toggle the error on and off just by adding or
> removing CONFIG+=C++11 in his .pro file.

Understood. I don't doubt that he can do that.

I still think the most likely explanation is that it's a preprocessing 
problem.

The compiler is complaining about errors on lines 495 and 496, which is the 
declaration of a template struct. The error messages are "expected '>' before  
'(' token" and "'complex' cannot be used as a function". I can't tell which of 
the two lines those errors occur because the screenshot cuts off the last digit 
of the line number.

Does anyone see a parenthesis or "complex" in those two lines?

That means one (or more) of the words used in those two lines is a #define. We 
know it's not "SignalArgs", because the compiler could see it. It can't be 
IndexesList because there were no errors above, where it was used. So it has 
to be one of:
	I
	R
	Function
	FunctorCall

I thought it was Function because it looked like the most likely term to be 
#defined. But the compiler did not flag an error on line 497, where Function is 
also used. The compiler could have got completely lost, though.

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.

> Erm... and I told him I give up. Strange things like that are far beyond
> what I can fix. Told him he should try to compile his Qt himself. Who knows
> what strange patches Ubuntu applied or what incompatible libs they hacked
> together. I had always very good experiences with my own Qt versions.

They may have, but the problem is not those patches. It's that he #included 
<complex.h> before <qobject.h>

-- 
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/20130814/6a23af0f/attachment.sig>


More information about the Interest mailing list