This is the mail archive of the gcc-help@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]

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.


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