Hello all, I am new to using templates and run into a problem:

I have a file foo.h:

#ifndef FOO_H_
#define FOO_H_

class foo{
template <unsigned int ID>
int doSomething();
virtual ~foo();

#endif /* FOO_H_ */

and a foo.cpp:

#include "foo.h"

foo::foo() {

template <unsigned int ID>
int foo:oSomething(){

foo::~foo() {

and in my main.cpp I want to do something like:

#include "foo.h"

int main(int argc, char *argv[]){
foo *bar = new foo();
return 0;

The problem is that whenever i try this i get undefined reference to `int foo:oSomething<2u>()

I have tried a number of variations to call the template (and tbh I am not even sure what I want to is possible) but no success.

Any Help would be greatly appreciated. Thank you.