MK53DN512CMD18 math.h problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MK53DN512CMD18 math.h problem

ソリューションへジャンプ
1,247件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
826件の閲覧回数
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!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
827件の閲覧回数
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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信