As stated in the same related answer from your question:
<math.h> is responsible for abs(int)<cmath> is responsible for std::abs(double)
If you have the topmost header file, just put the method below:
template<typename T> void abs (T);
Therefore, wherever the found abs found, a compiler error for its void will be reported as the return value. In addition, this function is not implemented to give at least a linker error.
This compiler error can be used to replace such abs() with std::abs() . For harmless abs(int) this is not expected to result in any error, since it is available in <math.h> .
Suppose you do not have a header file included in all source files, and then as a one-time exercise, you can replace each text #include<math.h> with #include<cmath> . However, this will not be full proof in all cases. For instance:
double my_abs () { using std::abs; return abs(x - y); }
Therefore, it is good to have a common utility header file in the entire source file as a practice. Let it be empty.
source share