Type changing problem (Float to Int)

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

Type changing problem (Float to Int)

ソリューションへジャンプ
2,024件の閲覧回数
monstor
Contributor II

When I change a Floating point number to unsigned integer and compile the source code, the compiler would tell me some error as below

 

Link Error : L1822 : Symbol _FUFLOAT in file C:\...........................\......c.o is undefined.

Link Error : L1822 : Symbol _FMUL in file C:\.........................................c.o is undefined.

Link Error : L1822 : Symbol _FADD in file C:\.........................................c.o is undefined.

Link Error : L1822 : Symbol _FDIV in file C:\.........................................c.o is undefined.

Link Error : L1822 : Symbol _FUTRUNC in file C:\.........................................c.o is undefined.

 

Below is my source code.

#include <stdlib.h>

#include <stdio.h>

#include <float.h>

#include <hidef.h>

 

uint16_t   TempBuffer;

float           TempBufferF;

 

int main() {

 

     TempBuffer = (uint16_t) TempBufferF;

 

      return 0;

}

 

I already put the header file "hidef.h". It seems cannot help.

 

Please help.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,781件の閲覧回数
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Henry,

Thanks for your response.

Your change from Ansib.lib to Ansibf.lib is correct, you need to use ansibf.lib rather than ansib.lib to enable floating point support.

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,781件の閲覧回数
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Henry,

Could you tell us which MCU are you using?

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 件の賞賛
返信
1,781件の閲覧回数
monstor
Contributor II

Dear Carlos,

I am using S12DP512 now. I just change the library from Ansib.lib to

Ansibf.lib. It seems can work. Is this method correct?

Best regards,

Henry

0 件の賞賛
返信
1,782件の閲覧回数
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Henry,

Thanks for your response.

Your change from Ansib.lib to Ansibf.lib is correct, you need to use ansibf.lib rather than ansib.lib to enable floating point support.

Hope it helps!

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 件の賞賛
返信