Hiding a standard library function in c++

Thursday, April 25, 2013 , 0 Comments

I have a function abs in one of the libraries and I wanted to use that function by linking to that library.But I am facing this error below:
function abs used is #define abs(x) (x > 0) ? x : -(x).
This is obviously from the standard includes that I used. So I found a some very nice ways to overcome this problem :

  • Wrapping the function name abs in parenthesis has resolved the problem right away.

  • Using the preprocessor directives Before you call the function abc in the library.
    #undef abs