undefined reference to, why

Viewed 229

g++: undefined reference to `A::sc', why? But statement a=sc is OK. because of the template?

#include <iostream>

template<typename T>
inline const T &min(const T &left, const T &right)
{
     return (left < right ? left : right);
}

class A 
{
public:
   static const size_t sc = 0;
   A() 
    {   
      size_t tmp = 0;
      size_t a = sc; 
      size_t b = min(sc, tmp);
    }   
};

int main()
{
  A a;
  return 0;
}                                                                                    
1 Answers
Related