Undefined reference to C++ template static data members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux