MK53DN512CMD18 math.h problem

cancel
Showing results for 
Search instead for 
Did you mean: 

MK53DN512CMD18 math.h problem

Jump to solution
509 Views
ing_albertopc
Contributor I

Hi, i´m usiing a MK53DN512CMD18 on a custom board and a need to do the operation below:

y=fabs(1.0-Accel_X);

The variables y and Accel_X are float type.

When i compile the proyect get the next warning:

Implicit declaration of function 'fabs' [-Wimplicit-function-declaration] incompatible implicit declaration of built-in function 'fabs' [enabled by default]  

And debugging got stock on that line of the fabs function, also with others functions of the math library.

I realy appreciate your help.

Regards

Alberto Peña

Labels (1)
0 Kudos
1 Solution
88 Views
trytohelp
NXP Employee
NXP Employee

Hi Alberto,

Do you use CW for MCU V10.6.4 ?

We're using 2 build tool chains for Kinetis: GCC and Freescale.

I've created a short example for both chain and according to the message it seems you're using GCC one.

On my side I got similar message:

    implicit declaration of function 'fabs' [-Wimplicit-function-declaration] incompatible implicit declaration of built-in function 'fabs' [enabled by default]

            main.c    /test/Sources    line 19    C/C++ Problem

The same code is built without warning with Freescale tool chain.

Why do you have this warning ?

The math.h is not listing included in the source file.

In this case the fabs file is not defined and the compiler will generate this warning.

If I add the  #include <math.h>, the warning is not anymore generated.

This is quite similar to another post:

    CW 10.6 Kinetis - "incompatible implicit declaration" of all math.h functions?

Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
89 Views
trytohelp
NXP Employee
NXP Employee

Hi Alberto,

Do you use CW for MCU V10.6.4 ?

We're using 2 build tool chains for Kinetis: GCC and Freescale.

I've created a short example for both chain and according to the message it seems you're using GCC one.

On my side I got similar message:

    implicit declaration of function 'fabs' [-Wimplicit-function-declaration] incompatible implicit declaration of built-in function 'fabs' [enabled by default]

            main.c    /test/Sources    line 19    C/C++ Problem

The same code is built without warning with Freescale tool chain.

Why do you have this warning ?

The math.h is not listing included in the source file.

In this case the fabs file is not defined and the compiler will generate this warning.

If I add the  #include <math.h>, the warning is not anymore generated.

This is quite similar to another post:

    CW 10.6 Kinetis - "incompatible implicit declaration" of all math.h functions?

Have a great day,
Pascal
Freescale Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos