i need your help with the parameterization of a template with an int value.
Thats how it looks like:
SpriteSwitcher.h:
template<int N >
bool initWithFilesArray(std::string (&fileNames)[N],int width, const CCPoint position);
SpriteSwitcher.cpp:
template<int N >
bool SpriteSwitcher::initWithFilesArray(std::string (&fileNames)[N], int width, const CCPoint position)
{
return true;
}
and then i try to initialize the class SpriteSwitcher with my initWithFileArray function
std::string g[2] = {"hello", "world"};
SpriteSwitcher *s = new SpriteSwitcher();
s->initWithFilesArray(g, visibleSize.width, origin);
and I get the following error:
error lnk2019 unresolved external symbol ""public: bool __thiscall SpriteSwitcher::initWithFilesArray<2>(class std::basic_string,class std::allocator > (&)[2],int,class cocos2d::CCPoint)" (??$initWithFilesArray@$01@SpriteSwitcher@@QAE_NAAY01V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HVCCPoint@cocos2d@@@Z)" in Funktion ""public: virtual bool __thiscall MenuScreen::init(void)" (?init@MenuScreen@@UAE_NXZ)".
Can anyone help me, and tell me where the problem is?