On 04/12/2012 04:07 PM, David C. Rankin wrote:
Tim, c/c++ folks,
I have worked gcc47 patches in most of the major packages to the point where I
have hit a common failure that I cannot solve. The common problem involves
error: redeclaration of (foo). Usually involving some iterator. The list of
packages that have a similar build failure are:
tde-kipi-plugins - error: redeclaration of 'TQListViewItemIterator it'
tde-tdepim - error: redeclaration of 'TQMap<TQGuardedPtr<KMFolder>,
int>::Iterator it'
tde-k3b - error: redeclaration of 'K3bAudioEditorWidget::Range* r'
rosegarden - error:
redeclaration of 'std::multiset<Rosegarden::Event*
I don't know what the various declarations are supposed to look like to begin
with so I sure can't recognize which one, and in what scope, the declarations
need to be fixed. Thanks for you help.
Here is the code-block from rosegarden that is failing in
src/document/RosegardenGUIDoc.cpp (line 2147 and 2152 designated with '*'):
* for (RecordingSegmentMap::iterator i = m_recordMIDISegments.begin();
i != m_recordMIDISegments.end();
++i) {
Segment *s = i->second;
* Segment::iterator i = s->begin();
if (i == s->end() || !(*i)->isa(Clef::EventType)) continue;
if ((*i)->getAbsoluteTime() < meaningfulBarStart) {
Event *e = new Event(**i, meaningfulBarStart);
s->erase(i);
s->insert(e);
}
I see the designations:
(1) RecordingSegmentMap::iterator i = m_recordMIDISegments.begin()
(2) Segment::iterator i = s->begin();
How is the compiler seeing ' RecordingSegmentMap::' and 'Segment::' as
the
same thing?
More importantly, how to fix it?
This is all withing the scope of:
2087 void
2088 RosegardenGUIDoc::stopRecordingMidi()
2089 {
...
2229 }
Grepping it looks like it is declared a number of times:
archangel:/dat_e/tmp/rosegarden/src/document> grep -En 'Segment[A-Za-z]*::'
RosegardenGUIDoc.cpp
<snip>
2099: std::vector<RecordingSegmentMap::iterator> toErase;
2101: for (RecordingSegmentMap::iterator i = m_recordMIDISegments.begin();
2109: for (Segment::iterator i = s->begin(); i != s->end(); ++i) {
2147: for (RecordingSegmentMap::iterator i = m_recordMIDISegments.begin();
2152: Segment::iterator i = s->begin();
2592: (Segment::Audio);
2710: for (RecordingSegmentMap::iterator ri = m_recordAudioSegments.begin();
What to do?
--
David C. Rankin, J.D.,P.E.