AFAIK math.h is the C version, which does not use namespaces, cmath is the C++ version that should use namespaces. When doing this I encountered the problem that abs would abs(int,int) and it did not work correctly for floats, that's why I added that line.

Quick test: including cmath instead of math.h results in  a similar error: redefinition of std::abs (g++).

So the best should be to remove my std::abs line and change include <math.h> to include <cmath>