Message: previous - next
Month: April 2012

c/c++ gurus - Help? [ was Re: [trinity-devel] Now kipi-plugins failing?? error: redeclaration of 'TQListViewItemIterator it']

From: "David C. Rankin" <drankinatty@...>
Date: Tue, 10 Apr 2012 18:06:50 -0500
On 04/05/2012 03:45 PM, David C. Rankin wrote:
> On 04/05/2012 01:39 PM, Darrell Anderson wrote:
>>>   But when it gets to the imagelist.cpp build, gcc is
>>> complaining that it has 2 declarations for 'TQListViewItemIterator it'???
>> The error message makes sense.
>> The declaration of TQListViewItemIterator it(d->listView); occurs five times, each time in a different function.
>> Apparently in function slotAddImages the declaration is seen twice. Once from the explicit declaration and once indirectly through a call to one of the other functions.
>> The first question is why gcc 4.7 doesn't like this when previous versions have. The second question is how to fix. I understand the message, but lack the C++ skills to know the remedy. Probaby easy for the C++ gurus.
> I 'think' it is this:
> -> G++ now correctly implements the two-phase lookup rules such that an
> unqualified name used in a template must have:
> (1) an appropriate declaration found either in scope at the point of definition
> of the template; or
> (2) by argument-dependent lookup at the point of instantiation.
> The question is if you have (1) & (2) instead of (1) | (2) do you get this
> redeclaration error??

The failure continues as of today. As Darrell pointed out, there are multiple
declarations of 'TQListViewItemIterator it( d->listView )' in
kipi-plugins/flickrexport/imageslist.cpp that are now both seen by gcc 4.7.
Could one of the c/c++ gurus take a look at suggest how to make sure this is
only seen once? Thanks.

David C. Rankin, J.D.,P.E.