Re: Linker error with static data member in templated class

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

 



On Friday, October 01, 2010 5:43 PM, Ian Lance Taylor wrote:

Andy Gibbs <andyg1001@xxxxxxxxxxxxx> 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




[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