This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Error with stl


Hello,

I've got a problem compiling the following source

michael@querx:~/tmp/xxx> g++ -Wall -O2 b.cpp
b.cpp: In member function âvoid bCls<T>::DumpItems()â:
b.cpp:15: error: expected `;' before âaIterâ

When I compile this code with borland's bcc it compiles without complaining. 
So I think it might be an error in g++ or it's because I just start 
programming in C++.

Hope You can help me, sicerely

        Michael Tomuschat


Here is the code:

# File b.cpp
#include <vector>
using std::vector;

template <class T> struct aCls {
   T val;
   aCls( T v) { val = v; }
};

template <class T> class bCls {
public:
   bCls( void) {}
   vector <struct aCls<T> > bLst;
   void AddItem( T v) { bLst.insert( bLst.end(), v); }
   void DumpItems( void) {
      vector<class aCls< T> >::iterator aIter;  // ???? tut nicht ????
   }
};

int main( void) {
   bCls<int> B;

   for( int i = 0; i < 10; i++) B.AddItem( i);
   return -1;
}

I'm using gcc:
michael@querx:~/tmp/xxx> g++ --version
g++ (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



-- 
Dipl. Ing. Michael Tomuschat

Ing.-BÃro Tomuschat       Tel. Â: 07071-943866
SteinbÃÃstr. 23         Fax  : 07071-943867 (wenn BÃro besetzt ist)
72074 TÃbingen         ÂE-mail: michael.tomuschat@planet-interkom.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]