Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in compiling C++ code on HP-UX ver 11

Status
Not open for further replies.

CG111

Programmer
Oct 30, 2003
3
IN
Hi i am trying to compile this C++ code using the aCC compiler version 3.33 on HP-UX ver 11. This same code is working on Solaris and AIX.

The code snippet is:

typedef typename std::list<Sink>::iterator ListSinkIterator;

for(ListSinkIterator i = m_Sinks.begin(); i != m_Sinks.end(); i++) {


Error is:
Error 537: &quot;../../../interface/shared/support/comsupport/SingleConPointImpl.h&quot;, line 565 # Cannot create a 'iterator' object; class iterator has only been seen as an incomplete declaration. for(ListSinkIterator i = m_Sinks.begin(); i != m_Sinks.end(); i++) {

Would appreciate any help on this.
 
Presumably m_Sinks is defined as something like

typedef std::list<Sink> ListSink;

ListSink m_Sinks;

Try

typedef std::list<Sink>::iterator ListSinkIterator;

Not sure if you really need typename.
 
Well the version of the compiler we are using is old, so it did not work without the typename.

However, I managed to find a workaround by splitting the definition in two parts. The original code was:

typedef typename std::list<Sink>::iterator ListSinkIterator;

With the following it compiled, though I still dont know why!

typedef typename std::list<Sink> ListSink;
typedef typename ListSink::iterator ListSinkIterator;


 
Looks like it cannot cope with :: after the template parameter. Never did figure out how the older compilers coped with templates.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top