title: How to compile template class in C++
body: <p>I'm getting error for every template class I use in my program. Even when I copied a solution from a website and try to compile it is giving error such as ,</p>
  
  <pre><code>set_prac.cc: In function ‘int main()’:
  set_prac.cc:10:13: error: ‘it’ does not name a type
  for (auto it = std::begin(foo); it!=std::end(foo); ++it)
           ^
  set_prac.cc:10:35: error: expected ‘;’ before ‘it’
  for (auto it = std::begin(foo); it!=std::end(foo); ++it)
                                 ^
  set_prac.cc:10:35: error: ‘it’ was not declared in this scope
  set_prac.cc:10:39: error: ‘end’ is not a member of ‘std’
  for (auto it = std::begin(foo); it!=std::end(foo); ++it)
  </code></pre>
  
  <p>..................
  ..................</p>
  
  <p>The program is ,
  <a href="http://www.cplusplus.com/reference/iterator/begin/" rel="nofollow">http://www.cplusplus.com/reference/iterator/begin/</a></p>
  
  <p>and it is running fine in their website . Is there any extra feature needed to compile C++ code that have template ?</p>
  
  <p>I am compiling it as ,</p>
  
  <p>g++ example.cc</p>