The present invention refers to compounds derived from trisubstituted 1H-pyrrole rings and aromatic rings, which have the following formula (I): as well as to the procedure for their preparation and the use thereof for the treatment of cancer by inhibiting histone deacetylases and the therapeutic use of biological processes related to the mentioned inhibition.