Type changing problem (Float to Int)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Type changing problem (Float to Int)

跳至解决方案
2,025 次查看
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,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 项奖励
回复
3 回复数
1,782 次查看
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,782 次查看
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,783 次查看
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 项奖励
回复