The problem was with this line.
typedef OpenMesh::Decimater::ModQuadricT< decimater >::Handle HModQuadric;
it should be like this:
typedef OpenMesh::Decimater::ModQuadricT< MyMesh >::Handle HModQuadric;
I was referring the documentation from version 2.0 while working on version 3.0
With recent versions, the templating depend on the mesh and not the decimater.