Undefined Reference - template
-
Hallo,
ich hab eine Frage zu ne Fehlermeldung, kann dich nicht nachvollziehen.
Ich habe eine .h
template <class T> class Blub { public: Blub(int size) { } bool isPrim(int x); };meine cpp
template <class T> bool Blub<T>::isPrim(int x) { if (x % 2 == 0) return false; const int max = static_cast<int>(static_cast<double>(sqrt(x))); for (int i = 0; i <= max; i++) { if (x % i == 0) return false; } return true; }Jetzt möchte ich z.B. in der Main die Funktion aufrufen.
Blub<int> Bla(1); bool moep = Bla.isPrime(2);Jedoch bekomm ich dabei immer die Fehlermeldung "undefined reference to `Blub<int>::isPrim(int)'"
Kann mir vielleicht jemand helfen?
Gruß
-
Punkt 5.
-
Achja, blöd von mir....
dankeschön

-
durch 0 und 1 willst du auch nicht teilen