I am trying to create a function that takes an arbitary number of strings and then outputs them all on a single line. I want this function to be a static member function of my Utils class.
Utils::output("I","am","a","sentence"); // --console-output--> I am a sentence
Here's what I've attempted:
Utils.h:
class Utils{
public:
template<typename First, typename ... Strings>
static void output(First arg, const Strings&... rest);
};
Utils.cpp:
void Utils::output() {
std::cout<<std::endl;
}
template<typename First, typename ... Strings>
void Utils::output(First arg, const Strings&... rest){
std::cout<<arg<<" ";
outputs(rest...);
}
main.cpp:
int main() {
Utils::output("I","am","a","sentence");
return 0;
}
My project is currently not even compiling! I am getting this error:
error LNK2019: unresolved external symbol "public: static void __cdecl Utils::output<char const *,char [3],char [2],char [9]>( referenced in function _main First.exe : fatal error LNK1120: 1 unresolved externals