Shop OBEX P1 Docs P2 Docs Learn Events
warning: implicit declaration — Parallax Forums

warning: implicit declaration

doggiedocdoggiedoc Posts: 2,245
edited 2012-08-26 12:23 in Propeller 1
I'm not sure how to correct this warning.
HB25.c:54:5: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]

As an exercise I am converting HB25.spin for SimpleIDE and wanted to set compile option to C99 to allow inline declarations, see this thread. But in the process, the code now generates the above warning where I try to use the absolute value function. Do I need a header declaration to resolve this warning? On a guess a tried adding #include <math.h> but that was not it. Here's the code snippet.
void Pause(int Duration) {
    int ClkCycles = (abs(Duration) * (CLKFREQ / 1000000) - 1050);
    waitcnt(ClkCycles + CNT);
}  

Thanks!
Paul

Comments

Sign In or Register to comment.