I created two source files (main.cpp, cal.cpp) and one header file (cal.h).
In cal.cpp,I defined one template function
template <class T>
T add_no(T a, T b){
return (a + b);
}
template add_no<int>;
In cal.h, declared that.
template <class T>
T add_no(T a, T b);
From main.cpp, I called
add_no(2, 5);
but getting the following error.
src\cal.cpp:30:10: error: ISO C++ forbids declaration of 'add_no' with no type [-fpermissive]
template add_no<int>;
^
src\cal.cpp:30:10: error: template-id 'add_no<int>' used as a declarator
src\cal.cpp:30:10: error: 'add_no(T, T)' is not a variable template
* [.pio\build\esp32dev\src\cal.cpp.o] Error 1
Any idea, how I can solve it?