This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I instantiated this way: template class Whatever<int>; Alex Holland 26415 SW Petes Mountain Rd West Linn, OR 97068 503-723-7264(W) 503-723-7317(FAX) -----Original Message----- From: Alexander Gdalevich [mailto:gdalevich@hotmail.com] Sent: Friday, April 05, 2002 7:17 PM To: alexh4912@yahoo.com Subject: RE: templates with gcc 2.95.2 for sh4 Thanks a lot. Please tell me, what syntax did you use? Did you just prototyped the methods like this: in .h file ----------------------- template<typename T> class Whatever { }; template<typename T> void Whatever<T>::SomeMethod(){ ... } ---------------------------------- in .cpp file ---------------------------------- class Whatever<int>; void Somefunction(Whatever<int> &); ---------------------------------- I tried that and it did not work. >From: "Alex Holland" <alexh4912@yahoo.com> >To: <crossgcc@sources.redhat.com> >Subject: RE: templates with gcc 2.95.2 for sh4 >Date: Fri, 5 Apr 2002 15:31:15 -0800 > > >For a 68K target, I have successfully used the -fno-implicit-templates >option and then explicitly instantiated the templates in a file called >templates.cpp and linked to it. I remember having some grief with the >other options. > >Alex > >-----Original Message----- >From: crossgcc-owner@sources.redhat.com >[mailto:crossgcc-owner@sources.redhat.com] On Behalf Of Alexander >Gdalevich >Sent: Friday, April 05, 2002 2:20 PM >To: crossgcc@sources.redhat.com >Subject: templates with gcc 2.95.2 for sh4 > >Hello! > >I am not sure I am posting this on the right board, that is I am not >certain >this is a generic gcc problem, or cross-gcc problem, so please direct me > >elsewhere if you know a more appropriate newsgroup. > >I am trying to compile a program using gcc 2.95.2 compiler for sh4 >platform >(win32/cygwin host). > >The problem is the way compiler handles C++ templates. For some reason >it >inlines all functions even if they are not declared inline or even if >they >are not written inside the class definition. > >GCC manual section 5.5 describes several ways of compiling templates. > >First opton is to compile with -frepo option. In this case compiler >will >generate *.rpo files with all template instantiations. Than, collect2 >will >update *.rpo files and tell the compiler to rebuild any affected object >files. > >I can't however use this, for we don't call collect2, but use our own >link >script. > >Second option is to comile code with -fno-implicit-templates to disable >the >implicit generation of template instances. The programmer than required >to >explicitly instantiate all the templates used, but even if I do that, I >get >link errors. > >I don't want to use #pragma interface and #pragma implementation tags >because they are deprecated, but I tried them anyway and I get link >errors. > >Also tried -falt-external-templates, but could not get my code to link >either. > >Any ideas? > > > >_________________________________________________________________ >Join the world's largest e-mail service with MSN Hotmail. >http://www.hotmail.com > > >------ >Want more information? See the CrossGCC FAQ, >http://www.objsw.com/CrossGCC/ >Want to unsubscribe? Send a note to >crossgcc-unsubscribe@sources.redhat.com > > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > > >------ >Want more information? See the CrossGCC FAQ, >http://www.objsw.com/CrossGCC/ >Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com > _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |