Hello everyone, I'm having problems with the linker.
It gives me the following error: [Linker error] undefined reference to `bool Polis :: deleteEdifice <Mine> (int) '
The prototype is declared as follows: template <typename T> bool deleteEdifice(int);
deleteEdifice is empty, that does not do anything for now but it does not work.
The call to the prototype is: obj->deleteEdifice<Mine>(3);
I also tried to do: obj->template deleteEdifice<Mine>(3);
Print the following error: `template' (as a disambiguator) is only allowed within templates
//.h file
class Polis
{
public:
//...constructor etc...
template <typename T>
bool deleteEdifice( int );
};
template <typename T>
bool Polis::deleteEdifice( int )
{
//Implementation here...
}
call method: obj->deleteEdifice<Mine>(3);
It gives me the following error: [Linker error] undefined reference to `bool Polis :: deleteEdifice <Mine> (int) '
//.h file
class Polis
{
public:
//...constructor etc...
template <typename T>
bool deleteEdifice( int );
};
template <typename T>
bool Polis::deleteEdifice( int )
{
//Implementation here...
}
class Mine{};
int main(){
Polis *obj;
obj->deleteEdifice<Mine>(3);
}