This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Template specialization produces multiple definitions
- From: "L P" <plm at iname dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 25 Oct 2003 07:33:19 +0800
- Subject: Template specialization produces multiple definitions
Hello,
After 3 days of reading and experiments I am stuck.
Suppose one t.h file declares a template class cT. Another tt.h includes t.h and contains cT template functions.
Function fspec() has general definition and a specialization for one type.
Now, I have TWO (!) files a.cpp and b.cpp, which both include tt.h and create objects of the same type of class cT.
All my attempts to compile such a project fail - fspec() multiple defined in a.o and b.o.
I tried my gcc3.2.2 (cross-compiled host=linux target=powerpc) with/without -frepo, with/without pragmas....
Is there any way to link this without extracting fcpec() into separate file (or enveloping into #ifdef...)?
Many thanks ahead for any help.
--
__________________________________________________________
Sign-up for your own personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
http://corp.mail.com/careers