Float Cast Causing Link Error

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

Float Cast Causing Link Error

跳至解决方案
1,556 次查看
rayhall
Contributor V

When I use a float to cast a value I get this link error that I do not know how to solve.

 

"Link Error : L1822  Symbol _FUFLOAT in file ...... is undefined"

 

This is an example of the code that causes the error.

 

uint16_t adc1, egt1;

 

egt1 = (int16_t)((float)adc1 / 204.8);

 

Ray.

标签 (1)
0 项奖励
回复
1 解答
1,295 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ray.

your project using float operation but  doesn't have floating library support.

when creating a new project, choose floating lib as i highlight below. this can solve the problem.

pastedImage_1.png

can this help?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,296 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ray.

your project using float operation but  doesn't have floating library support.

when creating a new project, choose floating lib as i highlight below. this can solve the problem.

pastedImage_1.png

can this help?


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,295 次查看
rayhall
Contributor V

Zhang Jun,

That worked.

It would be good if this setting could be changed after you have created the project.

Ray.

0 项奖励
回复
1,295 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ray,

We can remove the integral lib and add floating support lib into project.

In your CW project management window, “lib” folder, you could see one file called “ansibi.lib” (bank model for instance), please remove this lib from your project and import a new lib “ansib.lib” or “ansibf.lib” to substitute it.

The method to import is: right click project management window, click “Add files…”, then in the opened select files window, go to {CW install folder}\lib\hc12c\lib to import right lib file.

Let take small model lib as example:

-    ansibi.lib --- Integral only bank

-    ansib.lib --- IEEE32/32 bank

-    ansibf.lib  --- IEEE32/64 bank (compiler option: -Cf)

if you select IEEE32/64 support, you need add –Cf to compiler setting to let compiler know double is 64bit.

. if you have -D__NO_FLOAT__  in your compiler setting, please remove it.

You can go to the CW menu “help”, in “search”tab, input “ansibf.lib” and search, you could all the information of the lib file. I also attach the txt tells about that.

if this post is helpful to you, please click "Helpful" as "Yes". thanks!


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------