-template<typename T1 = Square> inline int distance(Square x, Square y);
-template<> inline int distance<File>(Square x, Square y) { return std::abs(file_of(x) - file_of(y)); }
-template<> inline int distance<Rank>(Square x, Square y) { return std::abs(rank_of(x) - rank_of(y)); }
-template<> inline int distance<Square>(Square x, Square y) { return SquareDistance[x][y]; }
+template<typename T1 = Square>
+inline int distance(Square x, Square y);
+
+template<>
+inline int distance<File>(Square x, Square y) {
+ return std::abs(file_of(x) - file_of(y));
+}
+
+template<>
+inline int distance<Rank>(Square x, Square y) {
+ return std::abs(rank_of(x) - rank_of(y));
+}
+
+template<>
+inline int distance<Square>(Square x, Square y) {
+ return SquareDistance[x][y];
+}