Implicit declaration of function abs – gcc-5.1.0

Compiling the following code using gcc-5.1.0 produces a warning:

warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]

Code:

#include <stdio.h>
#include <math.h>

int main (void)
{
  printf ("%dn", abs (-1));

  return 0;
}

I have compiled the same code with gcc-4.9.2 and it’s not producing any warning.


Source: gcc

Leave a Reply