While compiling my code, I keep getting the following linker error (the code compiles fine)
foo.cc:15: undefined reference to `void foo<int, int (*)(int)>(int*, unsigned long, int (*)(int))'
I'm fairly new to C++, and I'm pretty certain that my issue is coming from using template arguments, but I'm not sure where I am going wrong. The header for function foo
and how it is being called is shown below
template<typename T, typename F>
void foo(T* a, size_t b, F c);
...
// neither of these work
foo(ptr,val,func);
foo<int, int (*)(int)>(ptr,val,func);
and my implementation of foo is compiling fine. I'm not sure where the issue is coming from.