Linker error with static data member in templated class
Andy Gibbs
andyg1001@hotmail.co.uk
Mon Oct 4 08:22:00 GMT 2010
On Friday, October 01, 2010 5:43 PM, Ian Lance Taylor wrote:
> Andy Gibbs <andyg1001@hotmail.co.uk> writes:
>
>> // Initialise C3::op for type int
>> template<> C1 C3<int>::op;
>
> You are using specialization syntax but it seems to me that you want
> instantiation syntax, which would be
>
> template C1 C3<int>::op;
>
Thank you. It didn't quite work since this on its own gave a "explicit
instantiation of 'C3<int>::op' but no definition available" error. However,
doing:
template <typename T> C1 C3<T>::op;
template C1 C3<int>::op;
compiled and linked fine.
Thanks for pointing me in the right direction!
Andy
More information about the Gcc-help
mailing list