Hallo.
Ich habe eine klasse "Component" mit der Funktion:
Die habe ich dann in der cpp datei definiert:
Jetzt bekomme ich aber einen Link Fehler, wenn ich die addProperty funktion aufrufe:
Ich habe eine klasse "Component" mit der Funktion:
Code:
template <class T> bool addProperty (const std::string &name, T *value);
Code:
template <class T> bool Component::addProperty (const std::string &name, T *value)
{
if(properties.find(name) == properties.end())
{
properties[name] = value;
return true;
}
else
{
return false;
}
}
Was mache ich falsch?error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: bool __thiscall Component::addProperty<int>(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int *)" (****$addProperty@H@Component@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAH@Z)" in Funktion "_main".