roundf() function

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
guag_1662311
Level 1
Level 1
5 questions asked First reply posted First question asked

I am programming a CY8C5488AXI psoc. The program built successfully in the past. Now (after a few months), when I build it, I get the following error ( using PSoC Creator v4.4. with toolchain ARM GCC 5.4-2016-q2-update):

C:\ELENTECH Projects\Distiller Control\PSoC\Distiller_Control\Distiller_Control_Proto.cydsn/proj_support.c:2176: undefined reference to `roundf'
collect2.exe: error: ld returned 1 exit status
The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.
--------------- Build Failed: 12/22/2021 10:17:52 ---------------

This error refers to the following statement  that calls roundf() (supposedly in math library):
temp =  roundf(DAC_ONEDEGREE_COUNT * ((float) degrees));


The program has the #include <math.h>  statement, which should declare the roundf() function.
Any suggestions/comments?
Thanks!

0 Likes
1 Solution
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @guag_1662311,

Could you please try the below:

In Creator go to Project -> Build Settings -> Linker -> General

  Add "m" (without the quotes) into Additional Libraries. This will add the math library "Libm.a" to your project.

Krupashankar_0-1641316951653.png

 

Please let us know if this solves your problem.

 

Thanks,

Krupashankar

View solution in original post

0 Likes
4 Replies