f



compile error with templates in gcc 4.0.1 on Mac OSX 10.4

I have my own templated vector class and im trying to use my vector
class in another templated class. im using GCC 4.0.1 on Mac OSX (if i
need to upgrade that isnt a problem) but i want to know if this is a
misunderstanding on my part or a compiler issue, or there is a work
arround without requiring a compiler upgrade.

my vector looks like

template<typename T> class MyVector
{
private:
      //data
public:
     class iterator
     {
          //decl
     }

};

the class im trying to use it in looks like

template<typename T> class MyVectorUser
{
private:
      MyVector<T *> list;
      void dosomething()
      {
         for(MyVector<T *>::iterator i = list.begin() ; i !=
list.end() ; i++)
         {
            //code
         }
     }

};

the way im using the MyVectorUser is like this

struct MyData
{
    int x;

};

MyVectorUser<MyData> data;

however i get a compile error from GCC "error: expected `;' before
'i'"

can anyone please give me some insight?
0
musikit (5)
6/4/2008 3:16:19 PM
comp.lang.c++ 49423 articles. 6 followers. Post Follow

2 Replies
626 Views

Similar Articles

[PageSpeed] 1

musikit@gmail.com wrote:

> I have my own templated vector class and im trying to use my vector
> class in another templated class. im using GCC 4.0.1 on Mac OSX (if i
> need to upgrade that isnt a problem) but i want to know if this is a
> misunderstanding on my part or a compiler issue, or there is a work
> arround without requiring a compiler upgrade.
> 
> my vector looks like
> 
> template<typename T> class MyVector
> {
> private:
>       //data
> public:
>      class iterator
>      {
>           //decl
>      }

       };


> };
> 
> the class im trying to use it in looks like
> 
> template<typename T> class MyVectorUser
> {
> private:
>       MyVector<T *> list;
>       void dosomething()
>       {
>          for(MyVector<T *>::iterator i = list.begin() ; i !=
> list.end() ; i++)

  typename MyVector<T*>::iterator


>          {
>             //code
>          }
>      }
> 
> };
> 
> the way im using the MyVectorUser is like this
> 
> struct MyData
> {
>     int x;
> 
> };
> 
> MyVectorUser<MyData> data;
> 
> however i get a compile error from GCC "error: expected `;' before
> 'i'"
> 
> can anyone please give me some insight?


Best

Kai-Uwe Bux
0
jkherciueh (3186)
6/4/2008 4:24:27 PM
On Jun 4, 12:24 pm, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
> musi...@gmail.com wrote:
> > I have my own templated vector class and im trying to use my vector
> > class in another templated class. im using GCC 4.0.1 on Mac OSX (if i
> > need to upgrade that isnt a problem) but i want to know if this is a
> > misunderstanding on my part or a compiler issue, or there is a work
> > arround without requiring a compiler upgrade.
>
> > my vector looks like
>
> > template<typename T> class MyVector
> > {
> > private:
> >       //data
> > public:
> >      class iterator
> >      {
> >           //decl
> >      }
>
>        };
>
> > };
>
> > the class im trying to use it in looks like
>
> > template<typename T> class MyVectorUser
> > {
> > private:
> >       MyVector<T *> list;
> >       void dosomething()
> >       {
> >          for(MyVector<T *>::iterator i = list.begin() ; i !=
> > list.end() ; i++)
>
>   typename MyVector<T*>::iterator
>
>
>
> >          {
> >             //code
> >          }
> >      }
>
> > };
>
> > the way im using the MyVectorUser is like this
>
> > struct MyData
> > {
> >     int x;
>
> > };
>
> > MyVectorUser<MyData> data;
>
> > however i get a compile error from GCC "error: expected `;' before
> > 'i'"
>
> > can anyone please give me some insight?
>
> Best
>
> Kai-Uwe Bux

thank you very much for your help.
0
musikit (5)
6/4/2008 5:52:11 PM
Reply:

Similar Artilces:

Can't compile 2.6.0 on mac OSX 10.4/GCC 4.0
Hello, I am trying to compile wxMac 2.6.0 on a recently upgraded OSX 10.4, with Xcode 2.0 and GCC 4.0 installed. It fails with: ../bk-deps g++ -c -o coredll_webkit.o -I.pch/wxprec_coredll -D__WXMAC__ -I../src/tiff -I../src/jpeg -I../src/png -I../src/expat/lib -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -DWX_PRECOMP -DNO_GCC_PRAGMA -Ilib/wx/include/mac-ansi-release-2.6 -I../include -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -fpascal-strings -I../src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon -O2 -Wall -Wno-ctor-dtor-privacy -fno-common ../src/htm...

Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn
Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn 3 for Mac, MapleSoft Maple 11.01.303882 Pro for Mac, other Mac Stuff CDs, A to Z, updated 2007/10/15, and Win & Mac programs, 'WinMac', 'PC/ MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' please send e-mail to : ola 'AT' mail 'DOT' gr , ola3 'AT' mailbox 'DOT' gr ...

Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio P
Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn 3 for Mac, MapleSoft Maple 11.01.303882 Pro for Mac, other Mac Stuff CDs, A to Z, updated 2007/10/15, and Win & Mac programs, 'WinMac', 'PC/ MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' please send e-mail to : ola 'AT' mail 'DOT' gr , ola3 'AT' mailbox 'DOT' gr ...

Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn
Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn 3 for Mac, MapleSoft Maple 11.01.303882 Pro for Mac, other Mac Stuff CDs, A to Z, updated 2007/10/15, and Win & Mac programs, 'WinMac', 'PC/ MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' please send e-mail to : ola 'AT' mail 'DOT' gr , ola3 'AT' mailbox 'DOT...

Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio P #2
Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn 3 for Mac, MapleSoft Maple 11.01.303882 Pro for Mac, other Mac Stuff CDs, A to Z, updated 2007/10/15, and Win & Mac programs, 'WinMac', 'PC/ MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' please send e-mail to : ola 'AT' mail 'DOT' gr , ola3 'AT' mailbox 'DOT' gr ...

Compiling 8.13.4 with GCC 3.3--error, stdarg.h v. varargs.h on Mac OS X 10.4.1?
I'm trying to compile Sendmail 8.13.4 on Mac OS X 10.4.1, using GCC 3.3. I'm getting the message that GCC no longer supports varargs.h and code should be updated to use stdarg.h. I know this is a long-standing problem, and I used to be able to solve it (with Sendmail 8.12.x on Mac OS X 10.2.x and 10.3.x) by reverting to GCC 3.1. Unfortunately, GCC 3.1 is not installed on Mac OS X 10.4. The weird thing is that the last machine I build this way was Sendmail 8.13.3 on Mac OS X 10.3.7 and it compiled just fine with GCC 3.3. Possibly this had something to do with the fact that GCC 3...

wxWidgets 2.6.3 on Intel Mac with OS X 10.0.4 (Tiger), gcc 4.0.1
Hello, I have recently started porting our application to Mac OS X. Application was developed for Microsoft Windows using wxWidgets. I have installed wxWidgets 2.6.3 on my Mac using darwinports system. Compilation completed successfully and without any warnings/errors. I am able to compile same programs included in library archive, but started application does not receive ANY user input - I am even unable to move application window. Program is stripped to bare bones: #include "wx/wx.h" #include <iostream> class MyApp : public wxApp { public: virtual boo...

Mouse zoom not working in X11 on Mac OSX 10.7.3 (Lion) with gnuplot 4.4.4 or 4.6.0
I'm hoping somebody can help me figure out why the mouse zoom feature doesn't seem to be working in the X11 terminal on my Mac with OSX 10.7.3 and gnuplot 4.4.4 or 4.6.0 (I've tried both). I compiled gnuplot from source and everything else seems to be working fine. The output of "configure" shows that it was set up to compile with mouse zoom enabled: gnuplot will be compiled with the following features: Mouse support in interactive terminals: yes When the X11 window displays with the plot, the coordinates are shown in the lower left corner of the window...

Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, VIENNA INSTRUMENTS VIENNA SYMPHONIC LIBRARIES, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac
Microsoft Office 2008 for Mac, MacDrive 7.0.10, Apple Mac OSX Tiger 10.4.10 for Mac Intel, VIENNA INSTRUMENTS VIENNA SYMPHONIC LIBRARIES, Propellerheads.Reason.v4.0.HYBRID, Maya Unlimited 2008 for Mac, FXpansion GURU 1.1.280 for Mac, Roxio Popcorn 3 for Mac, MapleSoft Maple 11.01.303882 Pro for Mac, other Mac Stuff CDs, A to Z, updated 2007/10/15, and Win & Mac programs, 'WinMac', 'PC/MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' please send e-mail to : ola 'AT' mail 'DOT...

compile error with gcc-4.4.0
The following code gives me this error cidr.lo -MD -MP -MF .deps/cidr.Tpo -c cidr.cpp -fPIC -DPIC -o .libs/cidr.o cidr.cpp: In member function 'void ost::IPV4Cidr::set(const char*)': cidr.cpp:201: error: invalid conversion from 'const char*' to 'char*' cidr.cpp: In member function 'void ost::IPV6Cidr::set(const char*)': cidr.cpp:329: error: invalid conversion from 'const char*' to 'char*' make[2]: *** [cidr.lo] Error 1 make[2]: Leaving directory `/build/src/commoncpp2-1.6.2/src' The problem is the line : ep = strchr(cp, '/&#...

[ace-users] Re: [tao-support] Has ACE 5.4.4/TAO 1.4.4 been built with gcc 4.0.0 yet
Hi Robert, > When building ACE 5.4.4/TAO 1.4.4 using gcc 4.0.0 under fedora core > 4 test 2 on an x86 platform I get a lot of errors mainly to do with > template instantiations. Has anyone successfully build TAO/ACE using > the latest gcc ? We just added GCC 4.0.0 support to ACE+TAO recently. The forthcoming x.4.5 beta should work nicely with GCC 4.0.0. We hope to have this available very shortly (there's just one remaining snag with typecodes that should be fixed in the next day or so). If you'd like to give things a try before we release x.4.5 please dow...

Re: Subject: Building ACE 5.3.1 on Mac OS X (Tiger) 10.4.2 was [ace-users] Building ACE on Mac OSX 10.4
Hi Jason, Thanks for using the PRF. >> ACE VERSION: 5.3.1 This version of ACE is ANCIENT. The forthcoming ACE 5.4.8 beta should work "out of the box" for Mac OS X Tiger. If you want a preview, please download the version in our CVS repo at http://cvs.doc.wustl.edu/ take care, Doug >> HOST MACHINE and OPERATING SYSTEM: Mac OS X 10.4.2 >> COMPILER NAME AND VERSION (AND PATCHLEVEL): >> powerpc-apple-darwin8-gcc-4.0.1 >> >> CONTENTS OF $ACE_ROOT/ace/config.h: >> >> /* -*- C++ ...

[wx 2.6.3, Mac OS X 10.4.8, gcc 4.0.1] extremely slow wxStyledTextCtrl::Colourise()
Hello, I'm developing a multi-platform source code editor with syntax-highlighting based on wxWidgets. I have a problem with the wxStyledTextCtrl::Colourise() function on the Mac platform. This function is extremely slow on Mac, e.g. it takes about 40 seconds to do the lexing of a file of 500 lines of c++ code, while the same function returns within 1 second on the Windows and Linux platforms using the same version of wxWidgets. (I'm using the wxSTC_LEX_CPP lexer). The problem appears when the user wants to scroll down the wxStyledTextCtrl : the slider blocks and th...

RE: Subject: Building ACE 5.3.1 on Mac OS X (Tiger) 10.4.2 was [ace-users] Building ACE on Mac OSX 10.4 #2
Hi Doug, > > Thanks for using the PRF. > > >> ACE VERSION: 5.3.1 > > This version of ACE is ANCIENT. The forthcoming ACE 5.4.8 beta should > work "out of the box" for Mac OS X Tiger. If you want a preview, > please download the version in our CVS repo at I know it isn't the most recent version available, but this version is used extensively across the corporation. Changing the version of ACE all these products used will cause the architect's heads to explode ;) Is it your opinion that 5.3.1 is hopeless cause on ...

Web resources about - compile error with templates in gcc 4.0.1 on Mac OSX 10.4 - comp.lang.c++

Template - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Facebook page template & tips for 2014
As Facebook page admins get started with 2014, the social marketing experts at ShortStack created a detailed template , including image sizes, ...

Frame Artist Pro - Best Photo Collage Editor, Stitch Your Photos with Pic Frame Templates & Filter Effect ...
Get Frame Artist Pro - Best Photo Collage Editor, Stitch Your Photos with Pic Frame Templates & Filter Effect & Frames on the App Store. See ...

Paper wireframe templates - Flickr - Photo Sharing!
jasonrobb.com/v2/i/Wireframe-templates-JasonRobb.zip jasonrobb.com

United Airlines accidentally sends letter template to unhappy passenger
A US air passenger may have received what is quite possibly the world’s least sincere apology letter.

TV Templates - Transcripts
Lorem ipsum dolor sit amet, aihiad adaph dpas, osaf das. Oi asdfpo ijafj ai.

Mockup Apple Watch apps and compare screen sizes with these official bezel templates
... for developers, readers interested in Apple Watch can also use the images to compare the overall physical size of the two sizes. The templates ...

Paper by FiftyThree makes starting new projects easier with templates
... of its interface and functionality. With the new version of Paper, you can start new projects in a snap by using any of the app’s new templates. ...

Windows 10 patch messing with your Office 2016 templates? Here's how you can get them back
... 10 patch has had some Word 2016 users cringing in despair. The patch, titled Cumulative Update KB3124200 , is causing the Word 2016 template ...

Templates, Insights and Dictation in Google Docs
Google's standalone web apps for Docs , Sheets and Slides now show a list of templates you can choose to quickly create a document, spreadsheet ...

Resources last updated: 1/28/2016 6:04:50 PM