Undefined Reference Help
Im trying to practice the Class Templates example but i get an error in code blocks with the gnu gcc compiler: Here are my files: main.cpp: #include <iostream> #include "Pair.h" int main() { Pair <int> obj(11, 22); //undefined reference to 'Pair<int>::Pair(int,int) std::cout << obj.bigger() << std::endl; //undefined reference to 'Pair<int>::bigger()' return 0; } Pair.h (header and implementation files are in the same folder) : #ifndef PAIR_H #define PAIR_H template <class T> class Pair { private: T first, second; public: Pair (T a,T b); T bigger(); }; #endif // PAIR_H Pair.cpp: #include "Pair.h" template <class T> Pair<T>::Pair(T a,T b): first(a), second(b) { } template <class T> T Pair<T>::bigger() { return (first>second ? first : second); } So why am i getting those errors