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??