This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Undefined reference to C++ template static data members
- From: awatt <awatt at ipwireless dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 10 Jun 2010 04:40:53 -0700 (PDT)
- Subject: Undefined reference to C++ template static data members
Good afternoon.
I am attempting to compile some of our old template code with GCC 4.2.3. The
compilation stage is complete, however when I link I see some undefined
references to the template class static data members. So far I have been
unable to resolve these issues.
/cygdrive/s/ipw_products/sw_dev/common/pdc/tgt/rni/ose_ppc/./obj_app//pdc_rni.a(PDCProtocol.o):
In function `ServiceManager<DiffservService, DiffservServiceId,
100ul>::release()':
../../../incl/ServiceManager.cxx:278: undefined reference to
`ServiceManager<DiffservService, DiffservServiceId, 100ul>::s_used'
In the source code we attempt to initialise this static member as follows:
template <class Service, class ServiceId, UOPT16 NumberOfServices> Service*
ServiceManager<Service, ServiceId, NumberOfServices>::s_used = 0;
There does not seem to be a undefined reference for the non static member.
Does anyone know how to fix this?
Thanks
Arthur
--
View this message in context: http://old.nabble.com/Undefined-reference-to-C%2B%2B-template-static-data-members-tp28841884p28841884.html
Sent from the gcc - Help mailing list archive at Nabble.com.