Type changing problem (Float to Int)

cancel
Showing results for 
Search instead for 
Did you mean: 

Type changing problem (Float to Int)

Jump to solution
805 Views
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.

Labels (1)
Tags (1)
0 Kudos
1 Solution
562 Views
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

View solution in original post

0 Kudos
3 Replies
562 Views
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 Kudos
562 Views
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 Kudos
563 Views
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 Kudos