mardi 19 décembre 2017

Unresolved external symbol on variadic template c++ exception due to usage of unsigned int

I've declared a simple function with variadic template.

template<typename ...Args>
void Log(const LogLevel level, const char * format, Args ...args);

Upon calling it in the following manner -

Log(LogLevel::debug,
        R"(starting x, %d pending call for "%s" with param "%s")",
        id, first.c_str(),
       second.c_str())

where the variable types are : id (unsigned int), first (std::string) , second (std::string)

I'm getting the following error:

Error   LNK2001 unresolved external symbol "public: void __cdecl Log<unsigned int,char const *,char const *>(enum LogLevel,char const *,unsigned int,char const *,char const *)" 

When I remove the unsigned int argument from the function call - the error disappears. AFAIK the variadic template does support different types... so what am I missing?

Aucun commentaire:

Enregistrer un commentaire