sqrt problems with PSoC Creator and CY8C55 Family -- undefined reference to `sqrt' error

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

cross mob
Anonymous
Not applicable

All, I don't know if where this question should be asked here or PSoC Creator....but...

   

has anybody had problems with the sqrt() function? Here is a small test code to even see if it will compile and I get a "...undefined reference to `sqrt'..." error. The example is close to the Keil help context example.

   

Any sugestions?

   

Keith

   

/* ========================================
 *
 *
 * ========================================
*/
#include <device.h>
#include <math.h>

float temp;
float Vmag;

void main()
{
    temp = 234.5;
    Vmag = sqrt(temp);

    for(;;)
    {
    }
}
/* [] END OF FILE */
 

0 Likes
4 Replies
KishoreS_96
Employee
Employee
5 sign-ins 50 replies posted 25 replies posted

Hi Keith,

   

 

   

It worked fine for me. Here is my Debugger window screenshot.

   

   

If you are still facing any issues, could you please send me your testing project?

   

 

   

Regards,

   

Kishore.

0 Likes
KishoreS_96
Employee
Employee
5 sign-ins 50 replies posted 25 replies posted

Hi Keith,

   

 

   

Just now I realised that you are facing this issue with PSoC5 GCC Compiler and not with PSoC3 Keil Compiler. I have created a seperate project to test this and then I found out that it is because of math library not being included in GCC compiler.

   

 

   

Please refer to the KB article written by me for more details - http://www.cypress.com/?rID=42838

   

 

   

Regards,

   

Kishore.

Anonymous
Not applicable

That was it, man.... what a relief. Why aren't things like this better documented?

   

Thanks again,

   

Keith

0 Likes
Anonymous
Not applicable

 I scoured the web for this. Now the log() function works just fine. Thanks for the pointer.

   

 

   

gwdevprojects.blogspot.com

0 Likes